DEV Community

Cover image for From Zero to Production API in 5 Minutes
RapidKit
RapidKit

Posted on

From Zero to Production API in 5 Minutes

Let's Stop Talking. Let's Build.

Enough theory. We're building a real, production-ready FastAPI project from absolute zero.

Not a toy example. Not a template.

Timer starts now. ⏱️

📌 Source Code: github.com/getrapidkit/rapidkit-examples/tree/main/quickstart-workspace


Minute 0:00 — Prerequisites Check

You need:
• Node.js 20+
• Python 3.10+
• 5 minutes

That's it.

RapidKit handles:
• Poetry (auto-installed)
• Docker (configs provided)
• Dependencies (auto-managed)


Minute 0:30 — Create the Workspace

Workspace-based approach (recommended for multiple projects):

npx rapidkit quickstart-workspace
cd quickstart-workspace
npx rapidkit create project fastapi.standard product-api
cd product-api
Enter fullscreen mode Exit fullscreen mode

What you get:
• Clean src/ architecture
• Health check endpoint
• Docker & docker-compose ready
• CI/CD templates (GitHub Actions)
• Testing setup (pytest)
• Environment management (.env.example)
• Makefile for common tasks
• Shared .venv for all workspace projects

Generated code, not templates.


Minute 1:00 — Install Dependencies

# Activate workspace environment
source .rapidkit/activate

# Initialize project
rapidkit init
Enter fullscreen mode Exit fullscreen mode

What happens:

  1. Detects workspace environment
  2. Installs Poetry (if needed)
  3. Uses shared workspace .venv/
  4. Installs all project dependencies
  5. Sets up pre-commit hooks

Output:

✓ Poetry detected
✓ Using workspace virtualenv
✓ Installing dependencies
✓ Project ready!
Enter fullscreen mode Exit fullscreen mode

Minute 1:30 — First Run

rapidkit dev
Enter fullscreen mode Exit fullscreen mode

Output:

INFO: Uvicorn running on http://127.0.0.1:8000
INFO: Application startup complete.
Enter fullscreen mode Exit fullscreen mode

Open browser: http://localhost:8000/docs

You see Swagger UI with health endpoints:
GET /health — Overall health check
GET /api/health/livez — Liveness probe
GET /api/health/readyz — Readiness probe

Your API is running.


Minute 2:00 — Add Essential Modules

rapidkit add module settings
rapidkit add module auth_core  
rapidkit add module logging
Enter fullscreen mode Exit fullscreen mode

Settings module:
• Multi-source config (.env, env vars, YAML)
• Type-safe with Pydantic
• Environment-specific overrides

Auth Core module:
• PBKDF2 password hashing
• HMAC token signing
• Secure credential management

Logging module:
• Structured JSON logs
• Request/correlation tracking
• Configurable log levels

Check health endpoints:

{
  "status": "healthy",
  "timestamp": "2026-02-14T...",
  "modules": {
    "auth_core": "healthy",
    "settings": "healthy"
  }
}
Enter fullscreen mode Exit fullscreen mode

Minute 2:30 — Add Database

rapidkit add module db_postgres
Enter fullscreen mode Exit fullscreen mode

What you get:
• Async & sync SQLAlchemy engines
• Connection pooling with configurable limits
• Health checks with connection testing
• Alembic migrations ready
• Docker Compose with Postgres service

Environment configured in .env:

RAPIDKIT_DB_POSTGRES_URL=postgresql://postgres:postgres@localhost:5432/app_db
RAPIDKIT_DB_POSTGRES_TEST_URL=postgresql://postgres:postgres@localhost:5433/app_db_test
RAPIDKIT_DB_POSTGRES_POOL_SIZE=10
RAPIDKIT_DB_POSTGRES_MAX_OVERFLOW=20
Enter fullscreen mode Exit fullscreen mode

Start database:

docker-compose up -d postgres
Enter fullscreen mode Exit fullscreen mode

Check health:
http://localhost:8000/api/health/module/postgres


---

## Minute 3:00 — Add Redis Caching

Enter fullscreen mode Exit fullscreen mode


bash
rapidkit add module redis


**Redis features:**
• Async Redis client with connection pooling
• Automatic retry logic with exponential backoff
• Health monitoring with connection testing
• Configurable TTL and preconnection

**Environment configured in `.env`:**
Enter fullscreen mode Exit fullscreen mode


bash
REDIS_URL=redis://localhost:6379/0
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
CACHE_TTL=3600
REDIS_CONNECT_RETRIES=3


**Start Redis:**
Enter fullscreen mode Exit fullscreen mode


bash
docker-compose up -d redis


**Check health:**
http://localhost:8000/api/health/module/redis

---

## Minute 3:30 — Add Security & Middleware

Enter fullscreen mode Exit fullscreen mode


bash
rapidkit add module cors
rapidkit add module security_headers
rapidkit add module middleware


**CORS:**
• Whitelist origins for production
• Credential support enabled
• Preflight request handling

**Security Headers:**
• CSP, HSTS, X-Frame-Options configured
• Production-ready secure defaults

**Middleware:**
• Request ID tracking
• Response time recording
• Custom middleware support

**Your API now has enterprise-grade security.**

---

## Minute 4:00 — Add Deployment Config

Enter fullscreen mode Exit fullscreen mode


bash
rapidkit add module deployment


**Deployment features:**
• Production-ready Dockerfile (multi-stage builds)
• Docker Compose with all services
• GitHub Actions CI/CD workflows
• Makefile with common tasks
• Health check integration
• Environment-based configuration

---

## Minute 4:30 — Run Tests

Enter fullscreen mode Exit fullscreen mode


bash
rapidkit test


**Output:**
Enter fullscreen mode Exit fullscreen mode

===== test session starts =====
collected 15 items

tests/test_health.py ✓✓✓✓
tests/test_auth_core.py ✓✓✓
tests/test_db.py ✓✓✓✓
tests/test_redis.py ✓✓
tests/test_integration.py ✓✓

===== 15 passed in 3.2s =====


**All modules have tests included automatically.**

---

## Minute 5:00 — Deploy

**Using Makefile commands:**
Enter fullscreen mode Exit fullscreen mode


bash

Build Docker image

make docker-build

Run with docker-compose (all services)

make docker-up

Or manual Docker build

docker build -t product-api .
docker run -p 8000:8000 --env-file .env product-api


**Production deployment:**
• GitHub Actions workflows (auto-generated by deployment module)
• Multi-stage Dockerfile (optimized for production)
• Docker Compose with all services
• Health checks integrated
• Environment-based configuration

**Your API is production-ready.**

---

## ⏱️ Timer: 5:00

**What you built:**
✅ Workspace-based FastAPI project with clean architecture  
✅ JWT Authentication (register, login, refresh)  
✅ Database (PostgreSQL with async + sync engines)  
✅ Caching (Redis with retry logic)  
✅ Security (CORS + security headers)  
✅ Middleware (request tracking)  
✅ Logging (structured JSON with correlation IDs)  
✅ Configuration (multi-source with type safety)  
✅ Tests (passing with 15 test cases)  
✅ Docker (production-ready multi-stage builds)  
✅ CI/CD (GitHub Actions workflows)

**Lines of code written by you:** ~60 (configs)  
**Lines of code generated:** ~2,500+

---

## Project Structure

Enter fullscreen mode Exit fullscreen mode

quickstart-workspace/
├── .rapidkit/
│ ├── activate # Workspace activation script
│ └── .venv/ # Shared virtual environment
├── product-api/
│ ├── src/
│ │ ├── main.py # FastAPI app entrypoint
│ │ ├── cli.py # CLI commands
│ │ ├── health/ # Health check routes
│ │ ├── routing/ # API routes
│ │ └── modules/ # Installed modules
│ │ ├── settings/
│ │ ├── auth_core/
│ │ ├── db_postgres/
│ │ ├── redis/
│ │ ├── cors/
│ │ ├── security_headers/
│ │ ├── logging/
│ │ ├── deployment/
│ │ └── middleware/
│ ├── tests/ # Tests for all modules
│ ├── docker-compose.yml # Postgres + Redis services
│ ├── Dockerfile # Production multi-stage image
│ ├── pyproject.toml # Project dependencies
│ ├── .env.example # Environment template
│ └── Makefile # Common development tasks
└── README.md # Workspace documentation


**Every module:**
• Has its own directory
• Brings tests
• Updates health endpoint
• Configurable via `.env`

---

## What Makes This Different?

**Templates give you:**
• Example files
• You modify everything
• No upgrade path

**RapidKit gives you:**
• Production code
• Working integrations
• Upgradable modules
• Health checks included
• Tests included

**Key difference:**

Templates = **delete and modify**  
RapidKit = **add and build**

---

## Next Steps

**Add more features:**
Enter fullscreen mode Exit fullscreen mode


bash

Email sending

rapidkit add module email

Background tasks

rapidkit add module celery

File storage

rapidkit add module storage

Observability

rapidkit add module observability_core


**Each module integrates cleanly** — working together seamlessly.

---

## Troubleshooting: Health Check

**Something not working?**

Enter fullscreen mode Exit fullscreen mode


bash
npx rapidkit doctor


**Checks:**
• Python version
• Poetry installation
• RapidKit Core version
• Dependencies status

**Example output:**
Enter fullscreen mode Exit fullscreen mode

✅ Python: Python 3.10.19
✅ Poetry: Poetry 2.3.2
✅ pipx: pipx 1.8.0
✅ RapidKit Core: RapidKit Core 0.3.2
• Global (pipx): /home/user/.local/bin/rapidkit -> 0.3.2

✅ All required tools are installed!


**Instant diagnosis.** For detailed project checks, use `rapidkit doctor --workspace`.

---

## Try It Yourself

**Clone the example:**
Enter fullscreen mode Exit fullscreen mode


bash
git clone https://github.com/getrapidkit/rapidkit-examples.git
cd rapidkit-examples/quickstart-workspace/product-api
source ../.rapidkit/activate
rapidkit init
rapidkit dev


**Or create from scratch:**
Enter fullscreen mode Exit fullscreen mode


bash
time npx rapidkit create workspace my-workspace
cd my-workspace
time npx rapidkit create project fastapi.standard my-api
cd my-api
source ../.rapidkit/activate
time rapidkit init
time rapidkit dev




**Challenge:** Can you beat 5 minutes?

---

## FAQs

**Q: Is this production-ready?**  
Yes. Companies use generated projects in production.

**Q: Can I customize the code?**  
Yes. It's your code. Modify anything. RapidKit tracks changes and helps merge updates.

**Q: What if I add a module later?**  
RapidKit integrates it cleanly, preserving your custom code.

**Q: Do I need to learn RapidKit patterns?**  
No. It's **standard FastAPI code**. If you know FastAPI, you know this code.

---

## What's Next?

Next article: **"The Hidden Cost of Backend Boilerplate"** — why "just use a template" isn't good enough.

---

### Learn More

* 🌐 [getrapidkit.com](https://www.getrapidkit.com)
* 📦 [npm: rapidkit](https://www.npmjs.com/package/rapidkit)
* 🐍 [PyPI: rapidkit-core](https://pypi.org/project/rapidkit-core/)
* 🧩 [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode)
* 📂 [GitHub: rapidkit-examples](https://github.com/getrapidkit/rapidkit-examples)

---

**You just built a production-ready API in 5 minutes.**

Now go ship something.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)