Setting up a Dev environment
This is a guide to set up a dev environment for LearnHouse, it will guide you through the installation of the backend and the frontend.
Prerequisites
- Docker (opens in a new tab)
- Node.js 21.x (opens in a new tab)
- pnpm (opens in a new tab)
- Python 3.12.x (opens in a new tab)
- Poetry (opens in a new tab)
- macOS, Linux or Windows
Backend configuration
Get the repository
git clone https://github.com/learnhouse/learnhouse
cd learnhouse
Build & install LearnHouse
Make sure your container runtime has at least 4GB of RAM allocated, as default settings may vary by tool
This will build & run the backend and the database docker images
docker-compose up -d
This will install all the dependencies needed for the backend
- A Postgres database
- A Redis server
- A Collaboration nodejs server
- A built LearnHouse App* (Frontend & Backend)
You should ignore the Built LearnHouse App as it's not needed for the dev environment, in this case it will be useful only for installing learnhouse contents (Roles, Organization, Users in the database)
Run the backend in dev mode
You'll need to modify the config file to enable the install mode
Go to the backend folder
cd apps/api
Install python dependencies
poetry install
Run the Backend in Dev mode
poetry run python app.py
To learn more about Configuration options, please refer to the Configuration documentation
Check the API
Frontend configuration
Init the frontend
Go to the frontend folder
cd apps/web
This will install all the dependencies needed for the frontend, and for this you will need pnpm (opens in a new tab).
pnpm i
Add an .env file in the frontend folder with the following content
Setting MultiOrg to true won't work locally for now, please keep it false
NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=default
NEXT_PUBLIC_LEARNHOUSE_API_URL=http://localhost:1338/api/v1/
NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://localhost:1338/
NEXT_PUBLIC_LEARNHOUSE_DOMAIN=localhost:3000
NEXT_PUBLIC_LEARNHOUSE_TOP_DOMAIN=localhost
NEXT_PUBLIC_LEARNHOUSE_COLLABORATION_WS_URL=wss://localhost:1998
NEXTAUTH_SECRET="my-very-secret-key"
NEXTAUTH_URL=http://localhost:3000/
For details on organization hosting, see Organization Hosting Modes
Run the dev environment
pnpm run dev
Congratulations, you're done! 🎉
Visit the app at http://localhost:3000/ (opens in a new tab)
Next Steps
Thanks for contributing to LearnHouse 💟
You'll find here some issues/ features we need help with, feel free to contribute to any of them