🚀 Quick Start¶
Welcome to Backend-Antiginx — an API that queues security scan tasks in RabbitMQ and stores scan data/results in PostgreSQL. Get up and running in minutes. This guide takes you from zero to a working API.
🧭 Choose Your Setup¶
| Scenario | Best Path | Best For |
|---|---|---|
| Quick scan from terminal | CLI | Developers, Pentesters |
| Scan via pre-built image | Docker | DevOps, CI/CD |
| Backend with external network/services | Docker Compose | Backend / Queue-based setups |
✅ Requirements¶
- Go 1.25+ (if running without containers)
- Docker 24+ (for containers)
- Docker Compose (for orchestration)
- Available services: PostgreSQL 14+ and RabbitMQ 3.12+ (configured via environment variables)
- Optional:
jq— useful for CLI JSON output parsing
🔐 Environment Variables¶
| Variable | Description | Example |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgres://user:pass@localhost:5432/antiginx |
RABBITMQ_URL |
RabbitMQ connection string | amqp://user:pass@localhost:5672/ |
JWT_SECRET |
Secret key for JWT signing (required for auth endpoints) | super-secret-key |
BACKEND_PORT |
Host port mapping in compose | 4000 |
Save to .env in your project root:
DATABASE_URL=postgres://user:pass@localhost:5432/antiginx
RABBITMQ_URL=amqp://user:pass@localhost:5672/
JWT_SECRET=super-secret-key
BACKEND_PORT=4000
🛠️ Quick Start Locally (Go)¶
Clone the repo:¶
Navigate to the backend directory:¶
Set environment variables:¶
Run the application:¶
Test the health endpoint:¶
📡 API Overview¶
| Method | Path | Description | Requires JWT |
|---|---|---|---|
| GET | /api/health |
Service status | No |
| POST | /api/auth/register |
Register a user | No |
| POST | /api/auth/login |
Get authentication token | No |
| GET | /api/auth/me |
Get current user profile | Yes |
| POST | /api/scans |
Submit a new scan | No |
| GET | /api/scans/{id} |
Retrieve scan and results | No |
| POST | /api/results |
Submit results from workers | No |
Auth flow:
- Use
POST /api/auth/loginto obtain a token. - Use that token in
Authorization: Bearer <token>forGET /api/auth/me.
🔧 Troubleshooting¶
- No connection to PostgreSQL or RabbitMQ — verify
DATABASE_URLandRABBITMQ_URL; test port connectivity from host - 401 on
GET /api/auth/me— ensure headerAuthorization: Bearer <token>comes fromPOST /api/auth/login - 500 on login/token generation — check that
JWT_SECRETis set in environment - Port already in use — change
BACKEND_PORTin.envand re-map when running Docker/Compose - Migration errors — drop old test tables or verify database user permissions
🎯 What's Next?¶
- Want full parameter docs and all available tests? → CLI Guide
- Want to run via container image? → Docker Guide
- Want a worker + queue setup? → Docker Compose Guide