GitHub - null-pointer-sch/internal-platform-api: Internal developer platform API built with FastAPI for managing service boundaries and platform-level operations.

Quality Gate Status

A full-stack platform demo built with FastAPI (Backend) and Angular (Frontend) that explores patterns commonly used in internal developer platforms and platform engineering teams.

The API manages projects, environments, and deployments, inspired by tools such as Heroku, Render, Backstage, Humanitec, and custom internal PaaS solutions.

graph LR
    A[Client/CLI] --> B[Nginx Proxy]
    B --> C[Angular Frontend]
    B --> D[FastAPI Backend]
    D --> E[(PostgreSQL)]
    D --> F[Simulated Provisioner]
    F --> G[Simulated Deployment]
Loading

This project intentionally uses simulated provisioning and deployment flows to focus on API design, data modelling, authentication, and platform concepts, rather than real infrastructure execution.


๐ŸŒ Live Demo (Cloud Run โ€“ Europe)


๐Ÿš€ Features

๐Ÿ” Authentication & Security

  • Full Auth Flow: Register, Verify Email (Mock), Login, and Logout.
  • Dual Session Support: Uses Cookie-based sessions with CSRF protection (XSRF-TOKEN) for the browser/UI, and supports Bearer JWT for API-first usage.
  • Reverse Proxy Architecture: Nginx gracefully handles routing and path normalization (/api/v1).

๐Ÿ“ฆ Projects

  • Represent applications owned by authenticated users.
  • Full CRUD under /api/v1/projects.

๐ŸŒฑ Environments

  • Belong to a project with ephemeral or persistent types.
  • Lifecycle simulation: provisioning โ†’ running.
  • TTL support for ephemeral environments.
  • Dynamic metadata (Base URL/ID) assignment during provisioning.

๐Ÿšข Deployments

  • Version tracking (git SHA, tag) targeted at specific environments.
  • Lifecycle simulation: pending โ†’ running โ†’ succeeded.
  • Simulated async rollout and fake log streaming.

๐Ÿงฑ CI/CD & Infrastructure

  • Parallel Pipeline: Faster cycle times via concurrent test and dockerize jobs.
  • Smart Caching: GitHub Actions caching enabled for both npm and poetry.
  • Terraform IAC: Fully automated deployment to Google Cloud Run and Artifact Registry.
  • E2E Smoke Testing: Automated Python-based smoke tests (Backend, Frontend, and E2E) run on every push to ensure stability.

๐Ÿ›  Installation & Running Locally

1. Backend (FastAPI)

cd backend
poetry install
poetry run uvicorn app.main:app --reload --port 8000

Docs: http://localhost:8000/docs

2. Frontend (Angular)

cd frontend
npm install
npm start

UI: http://localhost:4200 (Note: requires running the backend or configuring a proxy).


๐Ÿงช Example Usage (with curl)

1. Register user

curl -s -X POST http://localhost:8000/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"test@example.com","password":"secret123"}'

2. Login

curl -s -X POST http://localhost:8000/api/v1/auth/login \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=test@example.com&password=secret123"

3. Create a project (Bearer Auth)

curl -s -X POST http://localhost:8000/api/v1/projects/ \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"payments","description":"payment service"}'

๐Ÿ“ Folder Structure

.
โ”œโ”€โ”€ backend/            # FastAPI Backend (Python 3.12, SQLAlchemy, Pydantic)
โ”œโ”€โ”€ frontend/           # Angular Frontend (Standalone Components, Signals)
โ”œโ”€โ”€ terraform/          # Infrastructure as Code (GCP Cloud Run)
โ””โ”€โ”€ scripts/            # E2E Smoke Testing Suite & CI/CD utilities

โšก๏ธ One-Command Setup (Local)

For the fastest local setup, use the provided Makefile:

# Installs both Backend & Frontend dependencies and starts the development servers
make all

Tip

Use make stop to kill all running processes and make clean to reset the database and clear caches.


๐Ÿ“œ License

MIT