Skip to content

Commit ac61b4d

Browse files
feat: inital backend boilerplate - Nginx - Docker 0.01
1 parent 5c78fb3 commit ac61b4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+18739
-238
lines changed

.env.example

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# =============================================================================
2+
# AngelaMos | 2025
3+
# .env.example
4+
# =============================================================================
5+
# Copy this file to .env and update values for your environment
6+
# =============================================================================
7+
8+
# =============================================================================
9+
# HOST PORTS (change these to avoid conflicts between projects)
10+
# =============================================================================
11+
NGINX_HOST_PORT=8420
12+
BACKEND_HOST_PORT=5420
13+
FRONTEND_HOST_PORT=3420
14+
POSTGRES_HOST_PORT=4420
15+
REDIS_HOST_PORT=6420
16+
17+
# =============================================================================
18+
# Application
19+
# =============================================================================
20+
APP_NAME=FullStack-Template
21+
ENVIRONMENT=development
22+
DEBUG=true
23+
LOG_LEVEL=INFO
24+
LOG_JSON_FORMAT=false
25+
26+
# =============================================================================
27+
# Server (internal container settings)
28+
# =============================================================================
29+
HOST=0.0.0.0
30+
PORT=8000
31+
RELOAD=true
32+
33+
# =============================================================================
34+
# PostgreSQL
35+
# =============================================================================
36+
POSTGRES_USER=postgres
37+
POSTGRES_PASSWORD=postgres
38+
POSTGRES_DB=app_db
39+
POSTGRES_HOST=db
40+
POSTGRES_CONTAINER_PORT=5432
41+
42+
DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_CONTAINER_PORT}/${POSTGRES_DB}
43+
44+
DB_POOL_SIZE=20
45+
DB_MAX_OVERFLOW=10
46+
DB_POOL_TIMEOUT=30
47+
DB_POOL_RECYCLE=1800
48+
49+
# =============================================================================
50+
# Redis
51+
# =============================================================================
52+
REDIS_HOST=redis
53+
REDIS_CONTAINER_PORT=6379
54+
REDIS_PASSWORD=
55+
56+
REDIS_URL=redis://${REDIS_HOST}:${REDIS_CONTAINER_PORT}
57+
58+
# =============================================================================
59+
# Security / JWT
60+
# =============================================================================
61+
SECRET_KEY=dev-only-change-this-in-production-minimum-32-characters-long
62+
63+
JWT_ALGORITHM=HS256
64+
ACCESS_TOKEN_EXPIRE_MINUTES=15
65+
REFRESH_TOKEN_EXPIRE_DAYS=7
66+
67+
# =============================================================================
68+
# CORS (must match HOST PORTS above!)
69+
# =============================================================================
70+
# Format: http://localhost:<NGINX_HOST_PORT>,http://localhost:<FRONTEND_HOST_PORT>
71+
# Update these if you change the host ports above
72+
73+
CORS_ORIGINS=http://localhost,http://localhost:8420,http://localhost:3420
74+
75+
# =============================================================================
76+
# Rate Limiting
77+
# =============================================================================
78+
RATE_LIMIT_DEFAULT=100/minute
79+
RATE_LIMIT_AUTH=20/minute
80+
81+
# =============================================================================
82+
# Frontend (Vite)
83+
# =============================================================================
84+
VITE_API_URL=/api
85+
VITE_APP_TITLE=My App
86+

.github/workflows/lint.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Lint & Type Check
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
lint:
13+
name: Run Linters
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
pull-requests: write
18+
contents: read
19+
20+
defaults:
21+
run:
22+
working-directory: backend
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.12'
32+
33+
- name: Set up uv
34+
uses: astral-sh/setup-uv@v4
35+
with:
36+
enable-cache: true
37+
cache-dependency-glob: "backend/pyproject.toml"
38+
39+
- name: Install dependencies
40+
run: uv sync --dev
41+
42+
- name: Run pylint
43+
id: pylint
44+
run: |
45+
echo "Running pylint..."
46+
if uv run pylint src > pylint-output.txt 2>&1; then
47+
echo "PYLINT_PASSED=true" >> $GITHUB_ENV
48+
echo "No pylint errors found!"
49+
else
50+
echo "PYLINT_PASSED=false" >> $GITHUB_ENV
51+
echo "Pylint found issues!"
52+
fi
53+
cat pylint-output.txt
54+
continue-on-error: true
55+
56+
- name: Run ruff
57+
id: ruff
58+
run: |
59+
echo "Running ruff check..."
60+
if uv run ruff check . > ruff-output.txt 2>&1; then
61+
echo "RUFF_PASSED=true" >> $GITHUB_ENV
62+
echo "No ruff errors found!"
63+
else
64+
echo "RUFF_PASSED=false" >> $GITHUB_ENV
65+
echo "Ruff found issues"
66+
fi
67+
cat ruff-output.txt
68+
continue-on-error: true
69+
70+
- name: Run mypy
71+
id: mypy
72+
run: |
73+
echo "Running mypy..."
74+
if uv run mypy . > mypy-output.txt 2>&1; then
75+
echo "MYPY_PASSED=true" >> $GITHUB_ENV
76+
echo "No mypy errors found"
77+
else
78+
echo "MYPY_PASSED=false" >> $GITHUB_ENV
79+
echo "Mypy found issues"
80+
fi
81+
cat mypy-output.txt
82+
continue-on-error: true
83+
84+
- name: Create Lint Summary
85+
id: create_summary
86+
if: github.event_name == 'pull_request'
87+
run: |
88+
{
89+
echo '## Lint & Type Check Results'
90+
echo ''
91+
92+
# Pylint Status
93+
if [[ "${{ env.PYLINT_PASSED }}" == "true" ]]; then
94+
echo '### Pylint: **Passed**'
95+
echo 'No pylint issues found.'
96+
else
97+
echo '### Pylint: **Issues Found**'
98+
echo '<details><summary>View pylint output</summary>'
99+
echo ''
100+
echo '```'
101+
head -100 pylint-output.txt
102+
echo '```'
103+
echo '</details>'
104+
fi
105+
echo ''
106+
107+
# Ruff Status
108+
if [[ "${{ env.RUFF_PASSED }}" == "true" ]]; then
109+
echo '### Ruff: **Passed**'
110+
echo 'No ruff issues found.'
111+
else
112+
echo '### Ruff: **Issues Found**'
113+
echo '<details><summary>View ruff output</summary>'
114+
echo ''
115+
echo '```'
116+
head -100 ruff-output.txt
117+
echo '```'
118+
echo '</details>'
119+
fi
120+
echo ''
121+
122+
# Mypy Status
123+
if [[ "${{ env.MYPY_PASSED }}" == "true" ]]; then
124+
echo '### Mypy: **Passed**'
125+
echo 'No mypy issues found.'
126+
else
127+
echo '### Mypy: **Issues Found**'
128+
echo '<details><summary>View mypy output</summary>'
129+
echo ''
130+
echo '```'
131+
head -100 mypy-output.txt
132+
echo '```'
133+
echo '</details>'
134+
fi
135+
echo ''
136+
137+
# Overall Summary
138+
if [[ "${{ env.PYLINT_PASSED }}" == "true" ]] && [[ "${{ env.RUFF_PASSED }}" == "true" ]] && [[ "${{ env.MYPY_PASSED }}" == "true" ]]; then
139+
echo '---'
140+
echo '### All checks passed!'
141+
else
142+
echo '---'
143+
echo '### Review the issues above and consider fixing them.'
144+
fi
145+
echo ''
146+
echo '<!-- lint-check-comment-marker -->'
147+
} > ../lint-report.md
148+
149+
- name: Post PR Comment
150+
if: github.event_name == 'pull_request'
151+
uses: peter-evans/create-or-update-comment@v4
152+
with:
153+
issue-number: ${{ github.event.pull_request.number }}
154+
body-path: lint-report.md
155+
comment-marker: lint-check-comment-marker

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
# AngelaMos | 2025
2+
# dev.compose.yml
3+
14
venv
2-
.venv
5+
*.venv
36
*.env
47
*.cache
58
*.egg
@@ -35,3 +38,4 @@ htmlcov/
3538
dmypy.json
3639

3740
.DS_Store
41+

README.rst

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,78 @@
11
==================
2-
My Full stack project set up for fastapi - nginx - docker - frontend (solid.js or react etc.)
2+
My fullstack project set up for:
3+
Fastapi - Nginx - Docker - React TS - SCSS
34
==================
5+
----
6+
7+
Setup
8+
=====
9+
10+
Option 1: GitHub Template (Recommended)
11+
---------------------------------------
12+
13+
Click the **"Use this template"** button above, or:
14+
15+
.. code-block:: bash
16+
17+
gh repo create my-project --template CarterPerez-dev/fullstack-template
18+
cd my-project
19+
20+
Option 2: Clone
21+
---------------
22+
23+
.. code-block:: bash
24+
25+
git clone https://github.com/CarterPerez-dev/fullstack-template.git my-project
26+
cd my-project
27+
rm -rf .git && git init
28+
29+
Prerequisites (Optional but Recommended)
30+
----------------------------------------
31+
32+
Install `just <https://github.com/casey/just>`_ command runner:
33+
34+
.. code-block:: bash
35+
36+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
37+
38+
Then add ``~/bin`` to your PATH if not already.
39+
40+
Installation
41+
------------
42+
43+
.. code-block:: bash
44+
45+
chmod +x setup.sh
46+
./setup.sh
47+
48+
Or if you have just:
49+
50+
.. code-block:: bash
51+
52+
just setup
53+
54+
This will:
55+
56+
- Copy ``.env.example`` → ``.env`` with generated ``SECRET_KEY``
57+
- Move template files (LICENSE, CONTRIBUTING, etc.) to root
58+
- Install backend dependencies (uv sync)
59+
- Install frontend dependencies (pnpm install)
60+
61+
Next Steps
62+
----------
63+
64+
1. Edit ``.env`` with your configuration
65+
2. Start development: ``just dev-up``
66+
3. After creating models: ``just migration-local "initial"`` then ``just migrate-local head``
67+
68+
Run ``just`` to see all available commands.
469

570
----
671

772
Documentation
873
=============
974

75+
Coming soon...
1076
----
1177

1278
Contributing

0 commit comments

Comments
 (0)