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
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
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 front folder with the following content
NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=test
NEXT_PUBLIC_LEARNHOUSE_API_URL=http://localhost:1338/api/v1/
NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://localhost:1338/
NEXT_PUBLIC_LEARNHOUSE_DOMAIN=localhost:3000
To learn about Organizations Hosting modes, please refer to the Organization Hosting Modes documentation
Run the dev environment
pnpm run dev
Configure your Organization as the default one
Copy this content to the .env file in the web folder
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_COLLABORATION_WS_URL=wss://localhost:1998
Make sure to change the NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG
to the organization you want to set as the default one, you''l find the organization slug in the database in the organizations
table
Here it is set to default
which is the default organization created by the backend when you ran the backend in the previous steps
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