Skip to content

null-pointer-sch/internal-platform-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

153 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Internal Developer Platform–Style API πŸš€

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

About

Internal developer platform API built with FastAPI for managing service boundaries and platform-level operations.

Resources

License

Stars

Watchers

Forks

Packages

Β 
Β 
Β 

Contributors