93 lines
3.8 KiB
Markdown
93 lines
3.8 KiB
Markdown
# Backend Modules
|
|
|
|
Backend modules provide feature-specific functionality for the Changemaker Lite platform. Each module follows a consistent architecture pattern with schemas, services, and routes.
|
|
|
|
## Module Architecture
|
|
|
|
Each module typically contains:
|
|
|
|
- **Schemas** (`*.schemas.ts`) - Zod validation schemas for requests/responses
|
|
- **Service** (`*.service.ts`) - Business logic and database operations
|
|
- **Routes** (`*.routes.ts`) - Express router definitions with middleware
|
|
- **Types** - TypeScript interfaces (when needed beyond Prisma types)
|
|
|
|
Modules may split routes into admin and public variants (e.g., `campaigns.routes.ts` and `campaigns-public.routes.ts`).
|
|
|
|
## Core Modules
|
|
|
|
### Authentication & User Management
|
|
|
|
- [**Auth Module**](auth.md) - JWT authentication, login, register, refresh tokens, logout
|
|
- [**Users Module**](users.md) - User CRUD, pagination, search, role management
|
|
- [**Settings Module**](settings.md) - Global site settings singleton
|
|
|
|
### Influence (Advocacy Campaigns)
|
|
|
|
- [**Campaigns Module**](campaigns.md) - Campaign CRUD, targeting, public views
|
|
- [**Representatives Module**](representatives.md) - Represent API integration, representative cache
|
|
- [**Responses Module**](responses.md) - Response wall, moderation, verification, upvoting
|
|
|
|
### Map & Location Services
|
|
|
|
- [**Locations Module**](locations.md) - Location CRUD, geocoding, NAR import, CSV operations
|
|
- [**Cuts Module**](cuts.md) - Polygon CRUD, spatial queries, point-in-polygon
|
|
- [**Shifts Module**](shifts.md) - Shift CRUD, volunteer signups, email notifications
|
|
- [**Canvass Module**](canvass.md) - Canvassing sessions, visit tracking, walking routes
|
|
|
|
### Content Management
|
|
|
|
- [**Pages Module**](pages.md) - Landing page CRUD, block library, MkDocs export
|
|
- [**Email Templates Module**](email-templates.md) - Template CRUD, variable processing, versioning
|
|
- [**Media Module**](media.md) - Video library, upload, metadata, reactions (Fastify API)
|
|
|
|
## Supporting Modules
|
|
|
|
### Infrastructure
|
|
|
|
- **Services Module** - Service health checks and monitoring
|
|
- **QR Module** - QR code PNG generation
|
|
- **Docs Module** - MkDocs and Code Server integration
|
|
|
|
### Integrations
|
|
|
|
- **Listmonk Module** - Newsletter sync, list management
|
|
- **Pangolin Module** - Tunnel management, resource configuration
|
|
- **Observability Module** - Prometheus/Grafana integration
|
|
|
|
### Email & Queuing
|
|
|
|
- **Campaign Emails Module** - Email tracking, statistics
|
|
- **Email Queue Module** - BullMQ queue administration
|
|
- **Postal Codes Module** - Postal code caching service
|
|
|
|
### Geocoding & Spatial
|
|
|
|
- **Geocoding Module** - Multi-provider geocoding (6 providers)
|
|
- **Tracking Module** - GPS tracking sessions (volunteer + admin)
|
|
- **Map Settings Module** - Map configuration singleton
|
|
|
|
## Module List
|
|
|
|
| Module | Purpose | Routes |
|
|
|--------|---------|--------|
|
|
| [auth](auth.md) | Authentication & sessions | `/api/auth/*` |
|
|
| [users](users.md) | User management | `/api/users/*` |
|
|
| [settings](settings.md) | Site settings | `/api/settings/*` |
|
|
| [campaigns](campaigns.md) | Advocacy campaigns | `/api/campaigns/*` |
|
|
| [representatives](representatives.md) | Representative lookup | `/api/representatives/*` |
|
|
| [responses](responses.md) | Response wall | `/api/responses/*` |
|
|
| [locations](locations.md) | Location database | `/api/locations/*` |
|
|
| [cuts](cuts.md) | Geographic cuts | `/api/cuts/*` |
|
|
| [shifts](shifts.md) | Volunteer shifts | `/api/shifts/*` |
|
|
| [canvass](canvass.md) | Canvassing system | `/api/canvass/*` |
|
|
| [pages](pages.md) | Landing pages | `/api/pages/*` |
|
|
| [media](media.md) | Video library | `/media-api/*` (port 4100) |
|
|
|
|
## Related Documentation
|
|
|
|
- [Backend Overview](../index.md)
|
|
- [Services](../services/index.md)
|
|
- [Middleware](../middleware/index.md)
|
|
- [Database Models](../../database/models/index.md)
|
|
- [API Reference](../../api-reference/index.md)
|