Run the platform locally
A first-day tutorial. Bring up the API and the Education Hub on your machine, sign in, and see a change travel from one to the other.
In this tutorial we get the Naalya platform running on your laptop. We start the API, point the Education Hub at it, sign in to the demo school, and finish by changing something in the API and watching the Hub pick it up.
It takes about an hour the first time, most of it waiting for installs. You need Node 22, Docker, and Git. Everything else is installed as we go.
The platform is three repositories. We use two of them here:
| Repository | What it is | Port |
|---|---|---|
Naalya-API | The NestJS server, worker, and audit apps | 8000 |
Education-Hub | The app that staff, students, guardians, and guests sign in to | 3000 |
Naalya-Website | The public school website. Optional for this tutorial | 5173 by default |
1. Clone both repositories side by side
mkdir naalya && cd naalya
git clone https://github.com/Naalya-Secondary-Schools/Naalya-API.git
git clone https://github.com/Naalya-Secondary-Schools/Education-Hub.git2. Give the API a database and a message broker
The API needs a Postgres database and a RabbitMQ broker that it does not start for you. Use anything you like. Here we run both in Docker so nothing is shared:
docker run -d --name naalya-postgres \
-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=naalya \
-p 5432:5432 pgvector/pgvector:pg17
docker run -d --name naalya-rabbitmq \
-p 5672:5672 -p 15672:15672 rabbitmq:4-managementIf you would rather use a hosted Postgres or broker, that works too. Getting started explains what each one must support.
3. Install Task and set up the API
Task is the API's command runner. Install it once:
brew install go-task # macOS
corepack enable # so pnpm matches the version the repo asks forOn Windows or Linux, follow the installation guide on the Task website. Then run setup in the API repo:
cd Naalya-API
task setupThe first run installs everything, creates .env.local, and stops to ask for credentials. Open .env.local and set:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/naalya
RABBIT_MQ_URL=amqp://guest:guest@localhost:5672
JWT_SECRET_KEY=any-long-random-string
R2_PUBLIC_BASE_URL=http://localhost:9999
SUPERADMIN_EMAILS=you@example.comUse your own email in SUPERADMIN_EMAILS. The other blank keys are for outside services such as email and AI. Leave them empty for now.
Run setup again. This time it starts Redis, Centrifugo, and Gotenberg, and builds the database:
task setup4. Start the API
task devWait until the server log says it is listening, then open http://localhost:8000/docs. You should see the interactive API reference. The server also created a demo school on its first start.
Leave this terminal running.
5. Set up and start the Hub
In a second terminal:
cd ../Education-Hub
cp .env.example .env.local
bun install
bun run dev:allIf you don't have Bun yet, install it first. The Bun website has the install command.
dev:all does two things at once: it starts the app on port 3000, and it watches the API's OpenAPI spec and regenerates the Hub's typed API client whenever the API changes. The default .env.local already points at http://localhost:8000.
Open http://localhost:3000.
6. Sign in
The email in SUPERADMIN_EMAILS is a platform operator, so it signs in on the operator page. Open http://localhost:3000/auth/operator, enter that email, and the Hub asks for a six-digit code.
We have not set up email, so the code is not sent anywhere. It is still in the email job. Open http://localhost:8000/queues, open the email queue, and open the newest job. The code is the otp value in its data. Type it into the Hub.
You are now signed in as a platform admin, on the platform hub at /platform/hub. From there you can see the demo school.
7. See a change travel from the API to the Hub
Now we prove the two are connected. In the API, open any controller and change the summary of one @ApiOperation, then save.
Watch the two terminals:
- The API restarts on its own (watch mode).
- Within about 20 seconds, the Hub's
apiprocess notices the new spec and regeneratessrc/services/api/_generated/.
That loop is how every API change reaches the Hub. Undo your edit when you are done.
What you have now
- The API on port 8000 with a database you own.
- The Hub on port 3000, signed in as a platform admin.
- Both in watch mode, so code changes apply as you save.
Where to go next
API getting started
The same setup in more depth, with troubleshooting.
Task commands
Every command in the API's Taskfile.
Education Hub getting started
The Hub's stack, codegen, and conventions.
Website getting started
Add the public website when you need it.
Add a resource module
Build your first feature end to end.
The steps follow Taskfile.yml, package.json, and .env.example in Naalya-API at fbb63d5178bcfe171292daebb19b6cbdac025a44, and package.json, .env.example, and api.config.toml in Education-Hub at 9e84f4c33d5f1a9b9ae84bd7f1e6663598504073. The tutorial was written from the code and has not yet been run end to end. If a step does not work, fix the page.