Skip to content

Commit 09eea45

Browse files
code-geekclaude
andcommitted
Initial commit: AI project template
- Django backend with Django Ninja API - Next.js frontend with TypeScript and Tailwind CSS - Docker configuration for development and production - GitHub Actions CI/CD workflows - Comprehensive documentation structure - AI-friendly CLAUDE.md files for guidance 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
0 parents  commit 09eea45

26 files changed

+1936
-0
lines changed

.github/workflows/ci.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
backend-test:
11+
name: Backend Tests
12+
runs-on: ubuntu-latest
13+
14+
services:
15+
postgres:
16+
image: postgres:16-alpine
17+
env:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
POSTGRES_DB: testdb
21+
options: >-
22+
--health-cmd pg_isready
23+
--health-interval 10s
24+
--health-timeout 5s
25+
--health-retries 5
26+
ports:
27+
- 5432:5432
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.12'
36+
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v3
39+
40+
- name: Install dependencies
41+
working-directory: ./backend
42+
run: uv sync --frozen
43+
44+
- name: Run linting
45+
working-directory: ./backend
46+
run: uv run ruff check .
47+
48+
- name: Run type checking
49+
working-directory: ./backend
50+
run: uv run mypy .
51+
52+
- name: Run tests
53+
working-directory: ./backend
54+
env:
55+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
56+
run: uv run pytest --cov=apps --cov-report=xml
57+
58+
- name: Upload coverage
59+
uses: codecov/codecov-action@v4
60+
with:
61+
file: ./backend/coverage.xml
62+
flags: backend
63+
64+
frontend-test:
65+
name: Frontend Tests
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Setup Node.js
72+
uses: actions/setup-node@v4
73+
with:
74+
node-version: '20'
75+
cache: 'npm'
76+
cache-dependency-path: ./frontend/package-lock.json
77+
78+
- name: Install dependencies
79+
working-directory: ./frontend
80+
run: npm ci
81+
82+
- name: Run linting
83+
working-directory: ./frontend
84+
run: npm run lint
85+
86+
- name: Run type checking
87+
working-directory: ./frontend
88+
run: npm run type-check
89+
90+
- name: Build application
91+
working-directory: ./frontend
92+
run: npm run build
93+
94+
- name: Run E2E tests
95+
working-directory: ./frontend
96+
run: npx playwright install --with-deps && npm run test:e2e
97+
98+
docker-build:
99+
name: Docker Build Test
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Build Backend Docker image
106+
run: docker build -t project-backend ./backend
107+
108+
- name: Build Frontend Docker image
109+
run: docker build -t project-frontend ./frontend
110+
111+
- name: Test Docker Compose
112+
run: |
113+
docker-compose up -d
114+
sleep 30
115+
curl -f http://localhost:8000/api/docs || exit 1
116+
curl -f http://localhost:3000 || exit 1
117+
docker-compose down

.github/workflows/deploy.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
env:
9+
AWS_REGION: us-east-1
10+
11+
jobs:
12+
deploy:
13+
name: Deploy to AWS
14+
runs-on: ubuntu-latest
15+
if: github.ref == 'refs/heads/main'
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v4
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: ${{ env.AWS_REGION }}
26+
27+
- name: Login to Amazon ECR
28+
id: login-ecr
29+
uses: aws-actions/amazon-ecr-login@v2
30+
31+
- name: Build and push Backend image
32+
env:
33+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
34+
ECR_REPOSITORY: project-backend
35+
IMAGE_TAG: ${{ github.sha }}
36+
run: |
37+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./backend
38+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
39+
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
40+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
41+
42+
- name: Build and push Frontend image
43+
env:
44+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
45+
ECR_REPOSITORY: project-frontend
46+
IMAGE_TAG: ${{ github.sha }}
47+
run: |
48+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./frontend
49+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
50+
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
51+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
52+
53+
- name: Update ECS service
54+
run: |
55+
aws ecs update-service \
56+
--cluster project-cluster \
57+
--service project-backend \
58+
--force-new-deployment
59+
60+
aws ecs update-service \
61+
--cluster project-cluster \
62+
--service project-frontend \
63+
--force-new-deployment
64+
65+
- name: Wait for services to stabilize
66+
run: |
67+
aws ecs wait services-stable \
68+
--cluster project-cluster \
69+
--services project-backend project-frontend
70+
71+
deploy-vercel:
72+
name: Deploy Frontend to Vercel
73+
runs-on: ubuntu-latest
74+
if: github.ref == 'refs/heads/main'
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Deploy to Vercel
80+
uses: amondnet/vercel-action@v25
81+
with:
82+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
83+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
84+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
85+
working-directory: ./frontend
86+
vercel-args: '--prod'

.gitignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
PIPFILE.lock
23+
24+
# Django
25+
*.log
26+
local_settings.py
27+
db.sqlite3
28+
db.sqlite3-journal
29+
media/
30+
staticfiles/
31+
32+
# Virtual environments
33+
venv/
34+
ENV/
35+
env/
36+
.venv/
37+
38+
# Node
39+
node_modules/
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
.pnpm-debug.log*
44+
45+
# Next.js
46+
.next/
47+
out/
48+
.vercel
49+
*.tsbuildinfo
50+
next-env.d.ts
51+
52+
# Testing
53+
coverage/
54+
.coverage
55+
htmlcov/
56+
.pytest_cache/
57+
.mypy_cache/
58+
.dmypy.json
59+
dmypy.json
60+
61+
# IDE
62+
.idea/
63+
.vscode/
64+
*.swp
65+
*.swo
66+
*~
67+
.DS_Store
68+
69+
# Environment variables
70+
.env
71+
.env.*
72+
!.env.example
73+
74+
# Production
75+
*.pem
76+
*.key
77+
*.crt
78+
79+
# Docker
80+
docker-compose.override.yml
81+
82+
# Logs
83+
logs/
84+
*.log
85+
86+
# OS
87+
Thumbs.db
88+
.DS_Store
89+
90+
# Temporary files
91+
*.tmp
92+
*.temp
93+
*.bak
94+
95+
# Build outputs
96+
dist/
97+
build/

0 commit comments

Comments
 (0)