import { Callout } from "nextra-theme-docs"; import { Steps } from "nextra-theme-docs"; # 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](https://docs.docker.com/get-docker/) - [Node.js 21.x](https://nodejs.org/en/download/) - [pnpm](https://pnpm.io/installation) - [Python 3.12.x](https://www.python.org/downloads/) - [Poetry](https://python-poetry.org/docs/) - macOS, Linux or Windows ## Backend configuration ### Get the repository ```bash copy git clone https://github.com/learnhouse/learnhouse ``` ```shell copy 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 ```shell copy 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 ```shell copy cd apps/api ``` #### Install python dependencies ```shell copy poetry install ``` #### Run the Backend in Dev mode ```shell copy poetry run python app.py ``` To learn more about Configuration options, please refer to the [Configuration](/self-hosting/configuration) documentation #### Check the API Go to [http://localhost:1338/docs/](http://localhost:1338/docs/) ## Frontend configuration ### Init the frontend Go to the frontend folder ```shell copy cd apps/web ``` This will install all the dependencies needed for the frontend, and for this you will need [pnpm](https://pnpm.io/). ```shell copy 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 ```env filename="apps/web/.env" {1-2} copy NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=defaultorg 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](/self-hosting/organization-hosting-modes) Run the dev environment ```shell copy pnpm run dev ``` ### Congratulations, you're done! 🎉 Visit the app at [http://localhost:3000/](http://localhost:3000/) ## 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 - [Help Wanted Issues](https://github.com/learnhouse/learnhouse/labels/help%20wanted)