Skip to content

Commit b6ed495

Browse files
Initial commit: Full-stack AI Business Operations Assistant
0 parents  commit b6ed495

70 files changed

Lines changed: 9602 additions & 0 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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Required — application will NOT start without these
2+
SECRET_KEY=generate-a-strong-random-key-here
3+
JWT_SECRET_KEY=generate-a-different-strong-random-key-here
4+
DB_PASSWORD=generate-a-strong-database-password
5+
6+
# Optional — AI analysis (falls back to mock if unset)
7+
OPENAI_API_KEY=
8+
9+
# Optional — defaults shown
10+
FRONTEND_URL=http://localhost
11+
RATELIMIT_STORAGE_URI=redis://redis:6379/0
12+
13+
# Frontend (used at build time)
14+
VITE_API_URL=/api
15+
16+
# Development only
17+
FLASK_DEBUG=false

.github/workflows/ci.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
BACKEND_IMAGE: ghcr.io/${{ github.repository }}/backend
12+
FRONTEND_IMAGE: ghcr.io/${{ github.repository }}/frontend
13+
14+
jobs:
15+
# ── CI: Lint, Test & Security Audit ──────────────────────────
16+
17+
backend-test:
18+
name: Backend — Lint & Test
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
working-directory: backend
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
cache: pip
31+
cache-dependency-path: backend/requirements.txt
32+
33+
- name: Install dependencies
34+
run: pip install -r requirements.txt
35+
36+
- name: Lint with pyright
37+
run: pip install pyright && pyright app/
38+
39+
- name: Run tests
40+
env:
41+
SECRET_KEY: ci-test-secret
42+
JWT_SECRET_KEY: ci-test-jwt-secret
43+
DATABASE_URL: "sqlite:///:memory:"
44+
run: python -m pytest tests/ -v --tb=short
45+
46+
- name: Security audit
47+
continue-on-error: true
48+
run: pip install pip-audit && pip-audit
49+
50+
frontend-test:
51+
name: Frontend — Lint, Type Check & Test
52+
runs-on: ubuntu-latest
53+
defaults:
54+
run:
55+
working-directory: frontend
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- uses: actions/setup-node@v4
61+
with:
62+
node-version: 20
63+
cache: npm
64+
cache-dependency-path: frontend/package-lock.json
65+
66+
- name: Install dependencies
67+
run: npm ci
68+
69+
- name: Type check
70+
run: npx tsc --noEmit
71+
72+
- name: Lint
73+
run: npm run lint
74+
75+
- name: Run tests
76+
run: npm test
77+
78+
- name: Security audit
79+
continue-on-error: true
80+
run: npm audit --audit-level=high
81+
82+
# ── CD: Build & Push Docker Images ──────────────────────────
83+
84+
build-and-push:
85+
name: Build & Push Docker Images
86+
runs-on: ubuntu-latest
87+
needs: [backend-test, frontend-test]
88+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
89+
permissions:
90+
contents: read
91+
packages: write
92+
93+
steps:
94+
- uses: actions/checkout@v4
95+
96+
- name: Log in to GitHub Container Registry
97+
uses: docker/login-action@v3
98+
with:
99+
registry: ${{ env.REGISTRY }}
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
102+
103+
- name: Set up Docker Buildx
104+
uses: docker/setup-buildx-action@v3
105+
106+
- name: Extract metadata
107+
id: meta
108+
run: |
109+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
110+
echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
111+
112+
- name: Build & push backend image
113+
uses: docker/build-push-action@v6
114+
with:
115+
context: ./backend
116+
push: true
117+
tags: |
118+
${{ env.BACKEND_IMAGE }}:latest
119+
${{ env.BACKEND_IMAGE }}:${{ steps.meta.outputs.sha_short }}
120+
cache-from: type=gha
121+
cache-to: type=gha,mode=max
122+
123+
- name: Build & push frontend image
124+
uses: docker/build-push-action@v6
125+
with:
126+
context: ./frontend
127+
push: true
128+
tags: |
129+
${{ env.FRONTEND_IMAGE }}:latest
130+
${{ env.FRONTEND_IMAGE }}:${{ steps.meta.outputs.sha_short }}
131+
cache-from: type=gha
132+
cache-to: type=gha,mode=max
133+
134+
# ── CD: Deploy (staging simulation) ─────────────────────────
135+
136+
deploy:
137+
name: Deploy to Staging
138+
runs-on: ubuntu-latest
139+
needs: [build-and-push]
140+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
141+
environment:
142+
name: staging
143+
url: https://staging.example.com
144+
145+
steps:
146+
- uses: actions/checkout@v4
147+
148+
- name: Deploy notification
149+
run: |
150+
echo "🚀 Deploying commit ${{ github.sha }}"
151+
echo " Backend: ${{ env.BACKEND_IMAGE }}:latest"
152+
echo " Frontend: ${{ env.FRONTEND_IMAGE }}:latest"
153+
154+
- name: Verify Docker Compose config
155+
env:
156+
DB_PASSWORD: ci-placeholder
157+
SECRET_KEY: ci-placeholder
158+
JWT_SECRET_KEY: ci-placeholder
159+
run: docker compose config --quiet
160+
161+
- name: Smoke test — container builds
162+
env:
163+
DB_PASSWORD: ci-placeholder
164+
SECRET_KEY: ci-placeholder
165+
JWT_SECRET_KEY: ci-placeholder
166+
FRONTEND_URL: "https://staging.example.com"
167+
run: |
168+
docker compose build
169+
echo "✅ All containers build successfully"
170+
171+
- name: Deployment summary
172+
run: |
173+
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
174+
echo "| Item | Value |" >> $GITHUB_STEP_SUMMARY
175+
echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
176+
echo "| **Commit** | \`$(git rev-parse --short HEAD)\` |" >> $GITHUB_STEP_SUMMARY
177+
echo "| **Backend Image** | \`${{ env.BACKEND_IMAGE }}:latest\` |" >> $GITHUB_STEP_SUMMARY
178+
echo "| **Frontend Image** | \`${{ env.FRONTEND_IMAGE }}:latest\` |" >> $GITHUB_STEP_SUMMARY
179+
echo "| **Status** | ✅ Ready for production |" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
dist/
3+
.env
4+
__pycache__/
5+
*.pyc
6+
uploads/
7+
migrations/
8+
*.db
9+
.venv/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Yousaf Zeb
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)