Appearance
Backend Setup
This guide covers the essential setup steps for the Jubiloop backend.
Prerequisites
- Node.js 22+ installed
- Docker running (for local PostgreSQL and Redis)
- Access to the monorepo
Initial Setup
1. Install Dependencies
From the project root:
bash
npm install2. Environment Configuration
The backend uses environment variables for configuration. These are automatically generated from env.deploy.yml:
bash
# For local development, .env files are created automatically
# when you run npm run devKey environment variables:
PORT- Server port (default: 3333)DATABASE_URL- PostgreSQL connection stringREDIS_URL- Redis connection stringAPP_KEY- Application secret keySESSION_DRIVER- Session storage (redis)
3. Database Setup
Run Migrations
bash
# From project root
npm run migration:run
# Or from server directory
cd apps/server
node ace migration:runSeed Database (Optional)
For development, you can seed the database with sample data:
bash
# From project root
npm run db:seed
# Or from server directory
cd apps/server
node ace db:seed4. Start the Server
bash
# From project root (starts all services)
npm run dev
# Or just the backend
npm run dev:serverThe API will be available at http://localhost:3333.
Common Tasks
Creating a New Migration
bash
cd apps/server
node ace make:migration create_table_nameRolling Back Migrations
bash
cd apps/server
node ace migration:rollbackAccessing the Database
bash
# Via Docker
docker exec -it jubiloop_local_dev_postgres psql -U postgres -d jubiloop_dev_db
# Connection details for GUI tools
# Host: localhost
# Port: 5433
# Username: postgres
# Password: postgres
# Database: jubiloop_dev_dbChecking Server Health
bash
curl http://localhost:3333/healthTroubleshooting
Port Already in Use
If port 3333 is already in use:
- Check what's using it:
lsof -i :3333 - Change the port in your
.envfile - Restart the server
Database Connection Failed
- Ensure Docker is running:
docker ps - Check PostgreSQL container:
docker logs jubiloop_local_dev_postgres - Verify DATABASE_URL in
.envfile - Try restarting Docker containers:bash
cd infra/local_dev docker compose restart
Redis Connection Failed
- Check Redis container:
docker logs jubiloop_local_dev_redis - Verify REDIS_URL in
.envfile - Ensure Redis is running:
docker exec -it jubiloop_local_dev_redis redis-cli ping
Next Steps
- Review AdonisJS Commands for CLI reference
- Check Controllers & Routing for API development
- See Data Models for database schema
- Read API Reference for endpoint documentation