VaultBox API is a secure cloud storage backend built with Fastify, Prisma, PostgreSQL, Redis, and JWT authentication.
The platform provides user accounts, storage plans, quota enforcement, file uploads, folder organization, signed download tokens, audit logging, administration tools, infrastructure monitoring, and billing-related account controls through a documented REST API.
https://vaultbox-api-ucff.onrender.com
The live deployment is hosted on Render's free tier.
If the API has been inactive for some time, Render may temporarily put the service to sleep.
Before testing any API endpoints:
- Visit:
https://vaultbox-api-ucff.onrender.com
-
Wait a few seconds for the service to wake up.
-
Open Swagger or begin testing endpoints.
Once awake, all endpoints function normally.
Swagger UI:
https://vaultbox-api-ucff.onrender.com/docs
Application Health:
https://vaultbox-api-ucff.onrender.com/health
Infrastructure Health:
https://vaultbox-api-ucff.onrender.com/infra/health
- User registration
- User login
- JWT authentication
- Password hashing with bcrypt
- Role-based access control
- Protected API routes
- Administrator privileges
- User accounts
- Account status tracking
- Active accounts
- Suspended accounts
- Deleted accounts
- Current user profile endpoint
- Multiple storage tiers
- Plan subscriptions
- Quota allocation
- Storage usage tracking
- Storage limit enforcement
- File uploads
- File listing
- File deletion
- File metadata tracking
- SHA256 checksum generation
- Upload audit logging
- Storage accounting
- Folder creation
- Folder listing
- Folder renaming
- Folder deletion
- Signed download tokens
- Expiring download links
- One-time token usage
- Download audit logging
- User management
- Account suspension
- Account reactivation
- User deletion
- Storage reporting
- Audit log access
- Failed payment simulation
- Automatic account suspension
- Account recovery workflow
- PostgreSQL database
- Redis integration
- Infrastructure health checks
- API rate limiting
- Swagger/OpenAPI documentation
VaultBox API follows a modular service-oriented architecture.
Core modules include:
- Authentication
- User Management
- Storage Plans
- Quota Enforcement
- File Management
- Folder Management
- Secure Downloads
- Billing
- Administration
- Audit Logging
- Infrastructure Monitoring
Data is stored in PostgreSQL through Prisma ORM while Redis provides infrastructure services such as caching, rate limiting, and operational support.
- Node.js
- Fastify
- Prisma ORM
- JWT
- bcrypt
- PostgreSQL
- Neon PostgreSQL
- Redis
- Upstash Redis
- Swagger
- OpenAPI
- Replit
- Render
vaultbox-api/
│
├── prisma/
│ ├── schema.prisma
│ └── seed.js
│
├── src/
│ ├── lib/
│ ├── middleware/
│ ├── routes/
│ ├── app.js
│ └── server.js
│
├── storage/
│ └── uploads/
│
├── .env.example
├── package.json
└── README.md
- User authenticates using JWT.
- User uploads a file.
- Storage quota is validated against the assigned plan.
- File metadata is stored in PostgreSQL.
- File is written to storage.
- Upload activity is recorded in audit logs.
- User generates a signed download token.
- Token expires automatically after the configured lifetime.
- Download activity is recorded in audit logs.
- JWT authentication
- Role-based access control
- Password hashing
- Storage quota enforcement
- Account suspension controls
- Signed download tokens
- Token expiration
- Audit logging
- Infrastructure monitoring
- Rate limiting
- Request validation
The database seeder automatically creates two accounts for testing.
Email: admin@vaultbox.dev
Password: Admin123!
Administrator capabilities:
- View all users
- Suspend users
- Reactivate users
- Delete users
- View audit logs
- View storage reports
- Access administrative endpoints
Email: user@vaultbox.dev
Password: User123!
Standard user capabilities:
- Login
- Manage folders
- Upload files
- Delete files
- View storage quota
- Change storage plans
- Generate download tokens
- Simulate billing failures
- Access user endpoints
POST /auth/register
POST /auth/login
GET /me
GET /plans
GET /quota
PATCH /plans/:planId/subscribe
POST /folders
GET /folders
PATCH /folders/:id
DELETE /folders/:id
POST /files/upload
GET /files
DELETE /files/:id
POST /files/:id/download-token
GET /download/:token
POST /billing/simulate-failed-payment
GET /admin/users
PATCH /admin/users/:id/suspend
PATCH /admin/users/:id/reactivate
DELETE /admin/users/:id
GET /admin/storage-report
GET /admin/audit-logs
GET /health
GET /infra/health
GET /docs
Interactive API documentation is available through Swagger UI.
http://localhost:4000/docs
https://vaultbox-api-ucff.onrender.com/docs
Swagger provides:
- Complete endpoint list
- Request parameters
- Request bodies
- Authentication requirements
- Response schemas
- Interactive endpoint testing
All available API functionality can be explored directly through the Swagger interface.
- Run database migrations:
npx prisma migrate deploy- Seed demo data:
node prisma/seed.js- Start the server:
npm run dev- Open Swagger:
http://localhost:4000/docs
- Login using either:
admin@vaultbox.dev
Admin123!
or
user@vaultbox.dev
User123!
-
Copy the JWT token returned from login.
-
Click the Authorize button in Swagger.
-
Paste the JWT token.
-
Test protected endpoints.
Before testing, visit:
https://vaultbox-api-ucff.onrender.com
This ensures the service is awake if Render has suspended the free-tier instance due to inactivity.
Then open:
https://vaultbox-api-ucff.onrender.com/docs
Login using:
admin@vaultbox.dev
Admin123!
or
user@vaultbox.dev
User123!
Copy the returned JWT token and use Swagger's Authorize button to test protected routes.
Clone the repository:
git clone https://github.com/wbizmo/vaultbox-api.gitMove into the project directory:
cd vaultbox-apiInstall dependencies:
npm installCreate an environment file:
cp .env.example .envGenerate Prisma Client:
npx prisma generateRun migrations:
npx prisma migrate deploySeed demo data:
node prisma/seed.jsStart development server:
npm run devPORT=4000
NODE_ENV=development
DATABASE_URL=
DIRECT_URL=
JWT_SECRET=
JWT_EXPIRES_IN=7d
APP_URL=http://localhost:4000
DOWNLOAD_TOKEN_EXPIRES_MINUTES=5
REDIS_URL=
REDIS_KEY_PREFIX=vaultboxRecommended hosted services:
Neon PostgreSQL
Upstash Redis
Use the pooled connection for application traffic:
DATABASE_URL=postgresql://username:password@project-pooler.region.aws.neon.tech/database?sslmode=requireFor migrations, use the direct connection:
DIRECT_URL=postgresql://username:password@project.region.aws.neon.tech/database?sslmode=requireVaultBox has been tested successfully with Neon PostgreSQL in production.
Use the TLS-enabled Redis URL:
REDIS_URL=rediss://default:password@your-upstash-instance.upstash.io:6379The rediss:// protocol is required for secure connections.
VaultBox has been tested successfully with Upstash Redis in production.
VaultBox can be deployed on:
- Render
- Railway
- Fly.io
- VPS environments
- Docker hosts
- Any Node.js-compatible hosting platform
Configure the following variables in your hosting provider:
DATABASE_URL=
DIRECT_URL=
REDIS_URL=
JWT_SECRET=
JWT_EXPIRES_IN=7d
APP_URL=
DOWNLOAD_TOKEN_EXPIRES_MINUTES=5rm -rf node_modules package-lock.json && npm install --omit=devnpm startApply migrations:
npx prisma migrate deploySeed demo accounts:
node prisma/seed.jsGenerate Prisma Client:
npx prisma generateCreate a migration:
npx prisma migrate dev --name migration_nameApply migrations:
npx prisma migrate deploySeed demo data:
node prisma/seed.jsStart development server:
npm run devProduction deployment has been validated using:
- Render
- Neon PostgreSQL
- Upstash Redis
Verified functionality includes:
- User registration
- User login
- JWT authentication
- Protected routes
- Plan subscriptions
- Folder management
- Storage quota tracking
- Swagger documentation
- PostgreSQL connectivity
- Redis connectivity
- Health monitoring endpoints
Live deployment:
https://vaultbox-api-ucff.onrender.com
Swagger documentation:
https://vaultbox-api-ucff.onrender.com/docs
Williams Ashibuogwu
GitHub
https://github.com/wbizmo
https://linkedin.com/in/wbizmo
Portfolio
https://my-portfolio-website-three-ebon.vercel.app
MIT License
Copyright (c) Williams Ashibuogwu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.