Skip to content

Commit 277731e

Browse files
committed
feat: add 6 Job Portal example projects for every architecture combo
Each example builds the same Job Portal (auth, OAuth, 2FA, CRUD, file uploads, emails, dashboard, deployment) using a different Grit configuration: 1. triple+next: Web + Admin + API with Next.js (SSR, SEO) 2. triple+vite: Web + Admin + API with TanStack Router (SPA, fast builds) 3. double+vite: Web + API, no admin panel (role-protected routes in web app) 4. single+vite: One Go binary with embedded React SPA (go:embed, like Laravel) 5. api-only: Pure Go API, no frontend (headless, mobile backend) 6. mobile+expo: Go API + Expo React Native (SecureStore, push notifications) Each includes: README.md (full setup), GUIDE.md (step-by-step tutorial), .env.example, docker-compose.prod.yml. Index README with architecture decision guide for LLMs and developers.
1 parent f5e14de commit 277731e

25 files changed

Lines changed: 6358 additions & 0 deletions

File tree

examples/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Grit Framework — Example Projects
2+
3+
Same **Job Portal** app built with every Grit architecture. Each example has identical features
4+
but different project structures, demonstrating how Grit adapts to your needs.
5+
6+
## Features (all examples)
7+
8+
- Auth: email/password + OAuth (Google, GitHub) + JWT + TOTP 2FA
9+
- Resources: Job, Company, Application, Category
10+
- Dashboard with stats cards
11+
- Data tables with sorting, filtering, pagination, export
12+
- File uploads via presigned URLs (company logos, resumes)
13+
- Emails (welcome, application confirmation)
14+
- Full deployment guide (README + .env.example + docker-compose.prod.yml)
15+
16+
## The 6 Examples
17+
18+
| Example | Architecture | Frontend | Command | Best For |
19+
|---------|-------------|----------|---------|----------|
20+
| [job-portal-triple-next](./job-portal-triple-next/) | Triple (Web + Admin + API) | Next.js | `grit new jp --triple --next` | SaaS, marketplaces, content platforms |
21+
| [job-portal-triple-vite](./job-portal-triple-vite/) | Triple (Web + Admin + API) | TanStack Router | `grit new jp --triple --vite` | Dashboards, internal tools with admin |
22+
| [job-portal-double-vite](./job-portal-double-vite/) | Double (Web + API) | TanStack Router | `grit new jp --double --vite` | Simpler apps without separate admin |
23+
| [job-portal-single-vite](./job-portal-single-vite/) | Single (one binary) | TanStack Router | `grit new jp --single --vite` | Laravel-like apps, microservices |
24+
| [job-portal-api-only](./job-portal-api-only/) | API Only | None | `grit new jp --api` | Mobile backends, headless APIs |
25+
| [job-portal-mobile-expo](./job-portal-mobile-expo/) | Mobile (API + Expo) | React Native | `grit new jp --mobile` | Mobile-first apps |
26+
27+
## How to Use These Examples
28+
29+
1. Pick the architecture that matches your project
30+
2. Read the README.md for setup instructions
31+
3. Read the GUIDE.md for a step-by-step walkthrough
32+
4. Copy the .env.example and docker-compose.prod.yml for deployment
33+
34+
## Architecture Decision Guide
35+
36+
```
37+
Do you need a separate admin panel?
38+
├── Yes → Triple (triple-next for SEO, triple-vite for speed)
39+
├── No → Do you need a web frontend?
40+
│ ├── Yes → Is SSR/SEO important?
41+
│ │ ├── Yes → Double + Next.js (grit new app --double --next)
42+
│ │ └── No → Double + Vite (grit new app --double --vite)
43+
│ └── No → Is this for mobile?
44+
│ ├── Yes → Mobile + Expo (grit new app --mobile)
45+
│ └── No → API Only (grit new app --api)
46+
└── Want one binary? → Single + Vite (grit new app --single --vite)
47+
```
48+
49+
## For LLMs / AI Assistants
50+
51+
If you are an AI assistant helping someone build with Grit:
52+
1. Ask which architecture they need (use the decision guide above)
53+
2. Reference the matching example for the correct project structure
54+
3. Read the .claude/skills/grit/SKILL.md in any Grit project for conventions
55+
4. Report bugs at https://github.com/MUKE-coder/grit/issues
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# ===============================================
2+
# Job Portal -- API Only -- Environment
3+
# ===============================================
4+
# Copy this file to .env and fill in the values.
5+
# Never commit .env to version control.
6+
7+
# -- Database ----------------------------------
8+
# PostgreSQL connection string (required)
9+
DATABASE_URL=postgres://grit:grit@localhost:5432/job_portal?sslmode=disable
10+
11+
# -- Server ------------------------------------
12+
# Go API listen address
13+
API_PORT=8080
14+
API_HOST=0.0.0.0
15+
16+
# Allowed CORS origins (comma-separated)
17+
# Set to your frontend URL(s) in production
18+
CORS_ORIGINS=*
19+
20+
# -- Authentication ----------------------------
21+
# JWT signing secret -- CHANGE THIS IN PRODUCTION
22+
JWT_SECRET=change-me-in-production-use-openssl-rand-base64-32
23+
24+
# JWT token lifetimes
25+
JWT_ACCESS_TTL=15m
26+
JWT_REFRESH_TTL=168h
27+
28+
# -- OAuth2 -- Google -------------------------
29+
# Create credentials at https://console.cloud.google.com/apis/credentials
30+
GOOGLE_CLIENT_ID=
31+
GOOGLE_CLIENT_SECRET=
32+
GOOGLE_REDIRECT_URL=http://localhost:8080/v3/auth/google/callback
33+
34+
# -- OAuth2 -- GitHub -------------------------
35+
# Create an OAuth app at https://github.com/settings/developers
36+
GITHUB_CLIENT_ID=
37+
GITHUB_CLIENT_SECRET=
38+
GITHUB_REDIRECT_URL=http://localhost:8080/v3/auth/github/callback
39+
40+
# -- Two-Factor Authentication ----------------
41+
# TOTP issuer name shown in authenticator apps
42+
TOTP_ISSUER=JobPortal
43+
44+
# -- Object Storage (S3-compatible) -----------
45+
# MinIO in dev, AWS S3 or Cloudflare R2 in prod
46+
STORAGE_ENDPOINT=localhost:9000
47+
STORAGE_ACCESS_KEY=minioadmin
48+
STORAGE_SECRET_KEY=minioadmin
49+
STORAGE_BUCKET=job-portal
50+
STORAGE_REGION=us-east-1
51+
STORAGE_USE_SSL=false
52+
53+
# Presigned URL expiration for uploads
54+
STORAGE_UPLOAD_TTL=15m
55+
56+
# -- Email (Resend) ---------------------------
57+
# Get your API key at https://resend.com/api-keys
58+
RESEND_API_KEY=
59+
RESEND_FROM=JobPortal <noreply@jobs.example.com>
60+
61+
# Mailhog SMTP for local development
62+
SMTP_HOST=localhost
63+
SMTP_PORT=1025
64+
SMTP_USER=
65+
SMTP_PASS=
66+
SMTP_FROM=noreply@localhost
67+
68+
# -- Redis ------------------------------------
69+
# Used for rate limiting, caching, and session storage
70+
REDIS_URL=redis://localhost:6379/0
71+
72+
# -- AI Gateway (optional) --------------------
73+
# Powers AI features like job description generation
74+
AI_GATEWAY_API_KEY=
75+
AI_GATEWAY_MODEL=gpt-4o-mini
76+
77+
# -- Logging ----------------------------------
78+
# Levels: debug, info, warn, error
79+
LOG_LEVEL=debug
80+
81+
# -- Rate Limiting ----------------------------
82+
# Max requests per window per IP
83+
RATE_LIMIT_MAX=100
84+
RATE_LIMIT_WINDOW=1m

0 commit comments

Comments
 (0)