A multi-tenant REST API platform with an admin portal for managing applications and API keys.
- Application registration with unique API keys
- Admin portal for application management
- Secure API endpoints with API key authentication
- Application domain description endpoint
- Dashboard for data insights
- Multi-tenant support
- Swagger API documentation
- Winston logging
- Rate limiting
- Security features (JWT authentication, Helmet, CORS)
- Node.js (v14 or higher)
- MongoDB
- Angular CLI
The project is organized into three main components:
application-api/
: Backend REST API service (Express.js)application-api-nestjs/
: Backend REST API service (NestJS)admin-portal/
: Frontend admin interface
-
Navigate to the backend directory:
cd application-api
-
Install backend dependencies:
npm install
-
Set up environment variables:
- Copy
.env.example
to.env
- Update the values in
.env
- Copy
-
Start the backend server:
npm start
-
Navigate to the NestJS backend directory:
cd application-api-nestjs
-
Install backend dependencies:
npm install
-
Set up environment variables:
- Copy
.env.example
to.env
- Update the values in
.env
:
PORT=3000 MONGODB_URI=mongodb://localhost:27017/multi-tenant-api JWT_SECRET=your-secret-key-here FRONTEND_URL=http://localhost:4200
- Copy
-
Start the backend server:
# Development npm run start:dev # Production npm run build npm run start:prod
-
Access the Swagger API documentation at:
http://localhost:3000/api-docs
-
Run tests:
# Unit tests npm run test # e2e tests npm run test:e2e # Test coverage npm run test:cov
The NestJS API will be available at http://localhost:3000
and the Swagger documentation at http://localhost:3000/api
.
- Node.js (v16+)
- Angular CLI (v17+)
- Navigate to admin-portal directory
cd admin-portal
- Install dependencies
npm install
- Start Development Server
ng serve
- Build for Production
ng build --configuration=production
- Update
src/environments/environment.ts
with your backend API URL - Ensure CORS is configured in backend for frontend access
- POST /api/auth/# - Admin login
- POST /api/applications - Register new application
- GET /api/applications - List all applications
- GET /api/applications/:id - Get application details
- PUT /api/applications/:id - Update application
- DELETE /api/applications/:id - Delete application
- GET /api/applications/test/domain - Get application domain description
Use JWT token in the Authorization header:
Authorization: Bearer <token>
Use API key in the X-API-Key header:
X-API-Key: <api-key>
The platform implements several security measures:
- JWT authentication for users
- API key authentication for applications
- Rate limiting
- Helmet security headers
- CORS protection
- Input validation
MIT