Skip to content

Commit d7eea14

Browse files
Merge pull request #1 from CarterPerez-dev/feature/backend
feat: inital backend boilerplate - Nginx - Docker 0.01
2 parents 6f80d1e + ff8743c commit d7eea14

84 files changed

Lines changed: 18743 additions & 238 deletions

Some content is hidden

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

.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: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
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: Cache pip dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.cache/pip
37+
key: ${{ runner.os }}-pip-${{ hashFiles('backend/pyproject.toml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pip-
40+
41+
- name: Install dependencies
42+
run: |
43+
python -m pip install --upgrade pip
44+
pip install -e ".[dev]"
45+
46+
- name: Run pylint
47+
id: pylint
48+
run: |
49+
echo "Running pylint..."
50+
if pylint src > pylint-output.txt 2>&1; then
51+
echo "PYLINT_PASSED=true" >> $GITHUB_ENV
52+
echo "No pylint errors found!"
53+
else
54+
echo "PYLINT_PASSED=false" >> $GITHUB_ENV
55+
echo "Pylint found issues!"
56+
fi
57+
cat pylint-output.txt
58+
continue-on-error: true
59+
60+
- name: Run ruff
61+
id: ruff
62+
run: |
63+
echo "Running ruff check..."
64+
if ruff check . > ruff-output.txt 2>&1; then
65+
echo "RUFF_PASSED=true" >> $GITHUB_ENV
66+
echo "No ruff errors found!"
67+
else
68+
echo "RUFF_PASSED=false" >> $GITHUB_ENV
69+
echo "Ruff found issues"
70+
fi
71+
cat ruff-output.txt
72+
continue-on-error: true
73+
74+
- name: Run mypy
75+
id: mypy
76+
run: |
77+
echo "Running mypy..."
78+
if mypy . > mypy-output.txt 2>&1; then
79+
echo "MYPY_PASSED=true" >> $GITHUB_ENV
80+
echo "No mypy errors found"
81+
else
82+
echo "MYPY_PASSED=false" >> $GITHUB_ENV
83+
echo "Mypy found issues"
84+
fi
85+
cat mypy-output.txt
86+
continue-on-error: true
87+
88+
- name: Create Lint Summary
89+
id: create_summary
90+
if: github.event_name == 'pull_request'
91+
run: |
92+
{
93+
echo '## Lint & Type Check Results'
94+
echo ''
95+
96+
# Pylint Status
97+
if [[ "${{ env.PYLINT_PASSED }}" == "true" ]]; then
98+
echo '### Pylint: **Passed**'
99+
echo 'No pylint issues found.'
100+
else
101+
echo '### Pylint: **Issues Found**'
102+
echo '<details><summary>View pylint output</summary>'
103+
echo ''
104+
echo '```'
105+
head -100 pylint-output.txt
106+
echo '```'
107+
echo '</details>'
108+
fi
109+
echo ''
110+
111+
# Ruff Status
112+
if [[ "${{ env.RUFF_PASSED }}" == "true" ]]; then
113+
echo '### Ruff: **Passed**'
114+
echo 'No ruff issues found.'
115+
else
116+
echo '### Ruff: **Issues Found**'
117+
echo '<details><summary>View ruff output</summary>'
118+
echo ''
119+
echo '```'
120+
head -100 ruff-output.txt
121+
echo '```'
122+
echo '</details>'
123+
fi
124+
echo ''
125+
126+
# Mypy Status
127+
if [[ "${{ env.MYPY_PASSED }}" == "true" ]]; then
128+
echo '### Mypy: **Passed**'
129+
echo 'No mypy issues found.'
130+
else
131+
echo '### Mypy: **Issues Found**'
132+
echo '<details><summary>View mypy output</summary>'
133+
echo ''
134+
echo '```'
135+
head -100 mypy-output.txt
136+
echo '```'
137+
echo '</details>'
138+
fi
139+
echo ''
140+
141+
# Overall Summary
142+
if [[ "${{ env.PYLINT_PASSED }}" == "true" ]] && [[ "${{ env.RUFF_PASSED }}" == "true" ]] && [[ "${{ env.MYPY_PASSED }}" == "true" ]]; then
143+
echo '---'
144+
echo '### All checks passed!'
145+
else
146+
echo '---'
147+
echo '### Review the issues above and consider fixing them.'
148+
fi
149+
echo ''
150+
echo '<!-- lint-check-comment-marker -->'
151+
} > ../lint-report.md
152+
153+
- name: Post PR Comment
154+
if: github.event_name == 'pull_request'
155+
uses: peter-evans/create-or-update-comment@v4
156+
with:
157+
issue-number: ${{ github.event.pull_request.number }}
158+
body-path: lint-report.md
159+
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)