Running the Application
This guide covers how to run the 2KRIKA backend service in different modes.
Prerequisites
Before running the application, make sure you have:
- ✅ Installed all dependencies
- ✅ Configured environment variables
- ✅ Set up your databases (SQL, MongoDB, Redis)
Database Setup
Run Migrations
Apply database migrations to create the required tables:
This runs Sequelize migrations from adapters/shared/sql/migrations/.
Seed the Database (Optional)
Load sample data for development:
This runs seed files from adapters/shared/sql/seeders/.
Development Mode
Start the development server with hot-reload:
The server will start on http://localhost:3000 (or the port specified in your PORT environment variable).
Features in Development Mode
- 🔄 Hot reload - Automatic restart on code changes
- 📝 Detailed logging - Console output for all operations
- 🐛 Error stack traces - Full error details for debugging
- 📊 Query logging - SQL queries logged to console
Production Mode
Build the Application
Compile TypeScript to JavaScript:
Built files are output to web/dist/.
Start Production Server
Testing
Run All Tests
Run Tests with Coverage
This generates a coverage report.
Run Tests in Watch Mode
Code Quality
Linting
Check code for linting errors:
Format Checking
Check code formatting:
Accessing the Application
API Endpoints
The API is available at:
Swagger Documentation
Interactive API documentation is available at:
Health Check
Check if the server is running:
Common Issues
Port Already in Use
If port 3000 is already in use, either:
- Stop the process using port 3000
- Use a different port:
Database Connection Errors
Verify your database connection strings:
Make sure all database services are running:
# Check PostgreSQL
pg_isready
# Check MongoDB
mongo --eval "db.runCommand({ connectionStatus: 1 })"
# Check Redis
redis-cli ping
Migration Errors
If migrations fail, check: 1. Database URL is correct 2. Database server is running 3. User has proper permissions
Reset and rerun migrations:
Next Steps
- API Overview - Explore available endpoints
- Development Guide - Development best practices
- Testing Guide - Writing and running tests