A community alert platform API where neighbours can report and share local incidents — think potholes, flooding, suspicious activity, power outages, and anything else worth flagging to the people nearby.
Built with AdonisJS v6 and PostgreSQL.
- User registration and authentication (token-based, via CPF or e-mail)
- Password reset flow with e-mail delivery
- Alert creation with categories, geolocation (reverse geocoding), and media attachments
- Media storage via local filesystem or Google Cloud Storage
- Real-time alert broadcasting via SSE (Server-Sent Events) with
@adonisjs/transmit - Auto-generated Swagger UI at
/docs
| Layer | Choice |
|---|---|
| Runtime | Node.js 20 |
| Framework | AdonisJS v6 |
| Language | TypeScript |
| Database | PostgreSQL (via Lucid ORM) |
| Auth | Token-based (DbAccessTokensProvider) |
| Storage | Local FS / Google Cloud Storage |
| Geocoding | Google Maps + OpenCage |
| Real-time | AdonisJS Transmit (SSE) |
| Validation | VineJS |
| API Docs | adonis-autoswagger |
- Node.js 20+
- PostgreSQL 14+
- pnpm
-
Clone and install dependencies
git clone <repo-url> cd eiVizinho-API pnpm install
-
Configure environment variables
cp .env.example .env
Fill in the required values:
Variable Description APP_KEYAdonisJS application secret (generate with node ace generate:key)DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_DATABASEPostgreSQL connection GOOGLE_MAPS_API_KEYGoogle Maps API key for reverse geocoding SMTP_HOST/SMTP_PORT/SMTP_USERNAME/SMTP_PASSWORDSMTP credentials for e-mail delivery GCS_BUCKET/GCS_KEY_FILENAMEGoogle Cloud Storage (only if DRIVE_DISK=gcs)TOKEN_EXPIRATION_IN_STRINGToken lifetime, e.g. 4wFILE_SIZE_LIMIT_IN_MBMax upload size, e.g. 250mb -
Start the database
docker compose up -d
-
Run migrations
node ace migration:run
-
Start the dev server
pnpm dev
The API will be available at
http://localhost:3333. The Swagger UI is athttp://localhost:3333/docs.
| Method | Path | Description |
|---|---|---|
POST |
/auth/login |
Authenticate with e-mail or CPF |
POST |
/auth/signup |
Register a new user |
POST |
/auth/password/reset/request |
Request a password reset e-mail |
GET |
/auth/password/reset/validate/:token |
Validate a reset token |
POST |
/auth/password/reset/:token |
Reset the password |
GET |
/alerts |
List all alerts |
GET |
/alert_category |
List all alert categories |
| Method | Path | Description |
|---|---|---|
GET |
/user/data |
Get the authenticated user's profile |
POST |
/alerts |
Create an alert (with media upload) |
GET |
/alerts/:id |
Get an alert by ID |
PUT |
/alerts/:id |
Update an alert |
DELETE |
/alerts/:id |
Delete an alert |
POST |
/alert_category |
Create an alert category |
Full request/response schemas are documented in the Swagger UI at /docs.
A multi-stage Dockerfile is included. To build and run the production image:
docker build -t eivizinho-api .
docker run -p 8080:8080 --env-file .env eivizinho-apipnpm dev # Start dev server with hot-reload
pnpm build # Compile TypeScript to JS
pnpm start # Start compiled production server
pnpm test # Run test suites
pnpm lint # Lint the codebase
pnpm format # Format with Prettier
pnpm typecheck # Type-check without emitting