Online Medrese Projesinin backend reposudur.
- Nest.js - Backend framework
- PostgreSQL - Database
- RabbitMQ - Message queue (configured for future use)
- Turborepo - Monorepo management
- TypeScript - Type-safe development
- Docker & Docker Compose - Containerization
- tedrisat - Education management service (Port: 3001)
- teskilat - Organization management service (Port: 3002)
Each service provides:
GET /- Hello World endpointGET /health- Health check endpoint
- Node.js 22+
- npm
- Docker & Docker Compose (optional)
-
Install dependencies:
npm install
-
Build all services:
npm run build
-
Database Setup (Tedrisat Service):
# Start PostgreSQL database
docker-compose up tedrisat-db -d
# Generate database migrations (runs for all services that have this script)
npm run db:generate
# Run migrations to create tables
npm run db:migrateAll database operations can now be run from the root using Turbo:
# Database operations (runs for all applicable services)
npm run db:generate # Generate migrations from schema changes
npm run db:migrate # Apply migrations to database
npm run db:check # Check for schema conflicts
npm run db:push # Push schema directly (development)
npm run db:studio # Open Drizzle Studio (database GUI)
npm run db:drop # Drop tables (use with caution)You can also run database commands for specific services:
# Run only for tedrisat service
npx turbo db:generate --filter=tedrisat
npx turbo db:migrate --filter=tedrisat
# Or navigate to specific service
cd apps/tedrisat
npm run db:generate
npm run db:migrate- Start all services in development mode:
npm run dev-
Start individual service:
# Teskilat service cd apps/teskilat && npm run dev # Tedrisat service cd apps/tedrisat && npm run dev
-
Start all services with dependencies:
docker-compose up -d
-
Stop all services:
docker-compose down
Tedrisat Service (http://localhost:3001)
GET /- Returns "Hello World from Tedrisat Service!"GET /health- Health checkGET /swagger- Swagger API documentation
Teskilat Service (http://localhost:3002)
GET /- Returns "Hello World from Teskilat Service!"GET /health- Health checkGET /swagger- Swagger API documentation
Both services include interactive Swagger documentation:
- Tedrisat Service: http://localhost:3001/swagger
- Teskilat Service: http://localhost:3002/swagger
The Swagger documentation provides:
- Interactive API explorer
- Request/response schemas
- Try-it-out functionality
- Complete endpoint documentation
The project uses a shared configuration system with environment variable validation:
- Shared Config: Located in
shared/config/ - Environment Variables: Centralized in root
.envfile - Override Support: Apps can override configs via
PORTenvironment variable - Validation: Uses Joi schema validation for type safety
Default values from .env:
-
TEDRISAT_PORT=3001- Tedrisat service port -
TESKILAT_PORT=3002- Teskilat service port -
DATABASE_URL- PostgreSQL connection (for future use) -
RABBITMQ_URL- RabbitMQ connection (for future use)
npm run build- Build all servicesnpm run dev- Start all services in development modenpm run start- Start all services in production modenpm run clean- Clean build artifactsnpm run type-check- Type check all servicesnpm run clean- Clean build artifactsnpm run db:generate- Generate database migrationsnpm run db:migrate- Run database migrationsnpm run db:studio- Open database management GUI
Copy .env file and adjust ports if needed:
TEDRISAT_PORT=3001TESKILAT_PORT=3002
.
├── apps/ # Independent services
│ ├── teskilat/ # Organization service
│ │ ├── src/
│ │ ├── Dockerfile
│ │ ├── package.json
│ │ └── tsconfig.json
│ └── tedrisat/ # Education service
│ ├── src/
│ ├── Dockerfile
│ ├── package.json
│ └── tsconfig.json
│
├── libs/ # Shared libraries
│ └── common/ # Common DTOs and utilities
│ ├── src/dto/
│ ├── package.json
│ └── tsconfig.json
│
├── shared/ # Shared configuration
│ └── config/ # Environment and configuration management
│
├── .env # Environment variables
├── docker-compose.yml # Docker services configuration
├── turbo.json # Turborepo configuration
├── package.json # Root dependencies
└── tsconfig.base.json # Base TypeScript configuration
The project is structured to easily add:
- Database integration with Drizzle ORM
- RabbitMQ message queues
- Shared utilities and types
- Authentication and authorization
- API documentation with Swagger
- Testing setup with Jest