|
1 | 1 | # Devsper Registry |
2 | 2 |
|
3 | | -Python package registry (API + web UI + Better Auth). All dev commands and config live in this folder. |
| 3 | +Python package registry with API (Go) + Web UI (React/TypeScript) + Better Auth. |
4 | 4 |
|
5 | | -## Local dev (host) |
| 5 | +Live at: [registry.devsper.com](https://registry.devsper.com) |
| 6 | + |
| 7 | +## Architecture |
| 8 | + |
| 9 | +- **API**: Go (port 8080) - Package management, user management, PEP-compatible `/simple/` endpoint |
| 10 | +- **Web**: React + TypeScript + Bun (port 3000) - UI + Better Auth integration |
| 11 | +- **Database**: PostgreSQL |
| 12 | +- **Auth**: Better Auth (GitHub, Google OAuth + email/password) |
| 13 | +- **Deployment**: AWS Lambda + API Gateway + CloudFront |
| 14 | + |
| 15 | +## Local Development |
6 | 16 |
|
7 | 17 | ```bash |
8 | | -cp .env.example .env # set DATABASE_URL; add GITHUB_CLIENT_ID/SECRET etc. for OAuth |
9 | | -just deps # start Postgres in Docker |
10 | | -just db-migrate # Go API tables (packages, orgs, …) |
11 | | -just auth-migrate # Better Auth tables (user, session, jwks, twoFactor, …) — see https://better-auth.com/docs/adapters/postgresql |
12 | | -just dev # API (air) + Web (Vite + Better Auth); Ctrl+C kills both |
| 18 | +cp .env.example .env # Configure DATABASE_URL, GITHUB_CLIENT_ID/SECRET, etc. |
| 19 | +just deps # Start Postgres in Docker |
| 20 | +just db-migrate # Create Go API tables (packages, orgs, etc.) |
| 21 | +just auth-migrate # Create Better Auth tables (user, session, jwks, etc.) |
| 22 | +just dev # Start API (air) + Web (Vite); Ctrl+C kills both |
| 23 | +``` |
| 24 | + |
| 25 | +### Endpoints |
| 26 | + |
| 27 | +- **Web UI**: http://localhost:3000 |
| 28 | +- **Auth**: http://localhost:3000/auth |
| 29 | +- **API**: http://localhost:8080 (proxied at `/api` and `/simple` from web) |
| 30 | + |
| 31 | +## Project Structure |
| 32 | + |
| 33 | +``` |
| 34 | +registry/ |
| 35 | +├── api/ # Go API server |
| 36 | +│ ├── cmd/ # Main entry point |
| 37 | +│ ├── internal/ # Internal packages |
| 38 | +│ └── Dockerfile.lambda |
| 39 | +├── web/ # React frontend |
| 40 | +│ ├── src/ # Source files |
| 41 | +│ └── Dockerfile.lambda |
| 42 | +├── migrations/ # Database migrations |
| 43 | +├── .env.example # Environment template |
| 44 | +├── justfile # Development commands |
| 45 | +└── docker-compose.*.yml |
13 | 46 | ``` |
14 | 47 |
|
15 | | -- **Web**: http://localhost:3000 (app + `/auth`) |
16 | | -- **API**: http://localhost:8080 (proxied at `/api` and `/simple` from the web app) |
| 48 | +## Deployment |
| 49 | + |
| 50 | +### AWS Lambda (Production) |
| 51 | + |
| 52 | +The registry runs on AWS Lambda with API Gateway: |
| 53 | + |
| 54 | +- **API Gateway**: `iyrvbekp4e.execute-api.us-east-1.amazonaws.com` |
| 55 | +- **Lambda Functions**: `devsper-registry-api`, `devsper-registry-web` |
| 56 | +- **ECR Images**: `devsper-registry-api`, `devsper-registry-web` |
| 57 | +- **CloudFront**: `E1OSV9Y9DPR3CY` → registry.devsper.com |
| 58 | +- **Database**: PostgreSQL on EC2 (44.219.173.39:5432) |
| 59 | + |
| 60 | +### Manual Deploy |
| 61 | + |
| 62 | +Build and push Docker images: |
| 63 | + |
| 64 | +```bash |
| 65 | +# API |
| 66 | +docker buildx build --provenance=false --platform linux/arm64 \ |
| 67 | + -t {AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/devsper-registry-api:latest \ |
| 68 | + -f api/Dockerfile.lambda . |
| 69 | +docker push {AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/devsper-registry-api:latest |
| 70 | +aws lambda update-function-code --function-name devsper-registry-api \ |
| 71 | + --image-uri {AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/devsper-registry-api:latest |
| 72 | + |
| 73 | +# Web |
| 74 | +docker buildx build --provenance=false --platform linux/arm64 \ |
| 75 | + -t {AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/devsper-registry-web:latest \ |
| 76 | + -f web/Dockerfile.lambda . |
| 77 | +docker push {AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/devsper-registry-web:latest |
| 78 | +aws lambda update-function-code --function-name devsper-registry-web \ |
| 79 | + --image-uri {AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/devsper-registry-web:latest |
| 80 | +``` |
| 81 | + |
| 82 | +## OAuth Setup |
| 83 | + |
| 84 | +See [docs/oauth-setup.md](docs/oauth-setup.md) for GitHub and Google OAuth configuration. |
| 85 | + |
| 86 | +## Docker Development |
| 87 | + |
| 88 | +See [README.docker.md](README.docker.md) for containerized development workflow. |
| 89 | + |
| 90 | +## PEP 503 / 691 Compatibility |
| 91 | + |
| 92 | +The `/simple/` endpoint implements PEP 503 (Simple Repository API) and PEP 691 (JSON API for PyPI), making it compatible with `pip`, `uv`, and other Python package managers: |
| 93 | + |
| 94 | +```bash |
| 95 | +pip install --index-url https://registry.devsper.com/simple/ devsper-plugin-example |
| 96 | +``` |
17 | 97 |
|
18 | | -If you had a root `.env.registry` before, copy it to `.env` (or copy `.env.example` and fill in values). |
| 98 | +## License |
19 | 99 |
|
20 | | -See [README.docker.md](README.docker.md) for Docker dev and [docs/oauth-setup.md](docs/oauth-setup.md) for GitHub/Google login. |
| 100 | +GPL-3.0-or-later |
0 commit comments