π Read this in: English | PortuguΓͺs
CoreOps is a backend API designed to manage organizations, users, units, and operational workflows with secure authentication, role-based access control (RBAC), and full audit logging.
The project follows a modular architecture focused on scalability, maintainability, and real-world production practices.
CoreOps was built to simulate a real-world multi-tenant operations platform, focusing on:
- Clean architecture
- Secure authentication
- Organization-scoped data
- Production-grade deployment
This project was designed as a portfolio piece to demonstrate backend engineering skills beyond CRUD APIs.
The API is live and available for testing.
- Base URL: https://coreops-production.up.railway.app
- API Docs (Scalar): https://coreops-production.up.railway.app/docs/
No installation required β test directly from the browser.
Use the following credentials to explore the API:
Admin User
- Email:
demo@coreops.dev - Password:
demo123
This user belongs to a demo organization and has full access.
- Node.js
- TypeScript
- Fastify
- Prisma ORM
- PostgreSQL
- Redis
- JWT Authentication
- Vitest
- Supertest
- Zod
The API is structured using a modular architecture, where each domain is isolated into its own module with:
- Controllers
- Services
- Schemas (DTOs)
- Routes
Shared logic (authentication, errors, audit logs, environment, redis) lives in dedicated shared or infra layers.
- JWT-based authentication
- Access Token & Refresh Token strategy
- Tokens include:
sub(user id)roleorganizationId
- Role-based access control using:
ensureAuthensureRole
- Supported roles:
ADMINMANAGERUSER
- Register organization and admin user
- Login
- Token generation
- Create users (ADMIN only)
- Organization scoped access
- Create and list organizational units
- Organization scoped access
- Create operations linked to units
- List operations with pagination and filters
- Update operation status
POST /api/auth/loginPOST /api/auth/refreshPOST /api/auth/logout
POST /api/usersGET /api/users
POST /api/unitsGET /api/units
POST /api/operationsGET /api/operationsPATCH /api/operations/:id/status
The project includes integration tests using Vitest and Supertest.
- Authentication flow
- RBAC enforcement
- Operations lifecycle
- Organization scoping
npm run testCreate a .env file based on .env.example:
NODE_ENV=development
PORT=3333
DATABASE_URL=postgresql://user:password@localhost:5432/coreops
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-secret-key
cd coreops-api
npm installnpx prisma migrate deploy
npm run dev
- Deployed using Docker
- Hosted on Railway
- PostgreSQL hosted on Supabase
- Redis hosted on Upstash (TLS enabled)
- Prisma migrations applied automatically on deploy
The application is production-ready and follows 12-factor app principles.
- Passwords are hashed using bcrypt
- JWT tokens are signed with environment-based secrets
- Refresh tokens are stored securely and rotated
- Organization-level data isolation enforced at service layer
- RBAC enforced via middleware
- HTTP security headers via Helmet
- CORS with allowlist
- Global rate limiting
- Stricter rate limiting on auth route
src/
βββ app/
β βββ modules/
β β βββ auth/
β β βββ operations/
β β βββ units/
β β βββ user/
β βββ shared/
β βββ audit/
β βββ auth/
β βββ errors/
β βββ middlewares/
|
βββ infra/
β βββ database/
β βββ env/
β βββ logger/
β βββ redis/
|
βββ tests/
β βββ helpers/
β βββ auth.spec.ts
β βββ operations.spec.ts
β βββ rbac.spec.ts
β βββ setup.ts
|
βββ index.ts
βββ server.ts
Every critical action is logged using the audit system, including:
- User creation
- Operation creation
- Operation status updates
Audit logs store:
- Action
- Entity
- Entity ID
- User ID
- IP (when available)
Centralized error handling using a global Fastify error handler.
Handled errors:
- Validation errors
- Authentication errors
- Authorization errors
- Not Found errors
- Conflict errors
- βοΈ Docker support
- βοΈ API documentation (Swagger / Scalar)
- βοΈ Refresh token rotation
- βοΈ Background jobs
- βοΈ Observability (logs & metrics)
- βοΈ Rate limiting
- βοΈ CORS & security hardening
Andrew GouvΓͺa
- GitHub: https://github.com/drewnetic
- LinkedIn: https://linkedin.com/in/andrew-gouvΓͺa-551b052a6