Enterprise-grade NestJS backend for managing developer projects, resources, secrets, and API keys with Keycloak authentication.
- Framework: NestJS + Fastify
- Database: PostgreSQL with Prisma ORM
- Auth: Keycloak Integration
- Docs: OpenAPI/Swagger
- Testing: Jest + Supertest
- Keycloak integration
- JWT token validation
- Role-based access control
- User registration & login
- Token refresh support
- CRUD operations
- Ownership validation
- Soft delete functionality
- Pagination & filtering
- Search capabilities
- Secure secrets storage
- API keys management
- Project-based organization
- Resource type validation
- Archive/restore support
- Track all critical actions (create/update/delete) for projects and resources
- Store logs in a dedicated table
- Expose an endpoint for admins to review logs
- Allow project/resource sharing with other users
- Implement granular permissions (read/write/admin) per resource/project
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Create database
psql -U postgres -c "CREATE DATABASE neststack_db;"
# Run database migrations
npx prisma migrate dev
# Development
npm run start:dev
# Production
npm run start:prod
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
Once the application is running, access the Swagger documentation at:
http://localhost:3000/api/docs
# Database
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/neststack"
# Keycloak
KEYCLOAK_AUTH_SERVER_URL="http://localhost:8080/auth"
KEYCLOAK_REALM="realm-name"
KEYCLOAK_CLIENT_ID="client-name"
KEYCLOAK_CLIENT_SECRET="your-client-secret"
# App
PORT=3000
NODE_ENV=development
src/
βββ audit-log/ # Audit Logging
βββ auth/ # Authentication & authorization
βββ dto/ # Data transfer objects
βββ keycloak/ # Keycloak implementation
βββ prisma/ # Database schema & migrations
βββ project/ # Project management
βββ project-permission/ # Project permission management
βββ resource/ # Resource management
βββ resource-permission/ # Resource premission management
βββ user/ # User informations management
# Create test database
psql -U postgres -c "CREATE DATABASE neststack_test;"
# Run tests with test environment
NODE_ENV=test npm run test
POST /api/auth/register
- Register new userPOST /api/auth/login
- User loginPOST /api/auth/logout
- User logout
GET /api/projects
- List all projectsPOST /api/projects
- Create projectGET /api/projects/:id
- Get projectPUT /api/projects/:id
- Update projectDELETE /api/projects/:id
- Delete project
GET /api/resources
- List all resourcesPOST /api/resources
- Create resourceGET /api/resources/:id
- Get resourceDELETE /api/resources/:id
- Delete resource
GET /api/resources
- List all audit log
GET /projects/{projectId}/permissions
- List permissions releated to projectPOST /projects/{projectId}/permissions
- Create permissions for projectGET /resources/{resourceId}/permissions
- List permissions releated to resourcePOST /resources/{resourceId}/permissions
- Create permissions for resource
Jawher Kallel
- Github: @JawherKl
This project is MIT licensed.