Full-stack file storage app. Node.js/Express backend + React frontend, connected to RDS PostgreSQL and Amazon S3.
filevault/
├── backend/
│ ├── server.js # Express entry point
│ ├── db.js # PostgreSQL connection + schema init
│ ├── s3.js # S3 client + multer-s3 upload
│ ├── middleware/auth.js # JWT auth middleware
│ ├── routes/
│ │ ├── auth.js # POST /api/auth/login|register
│ │ ├── files.js # GET/POST/DELETE /api/files
│ │ └── clients.js # CRUD /api/clients
│ └── .env.example # Copy to .env and fill in values
└── frontend/
└── src/
├── App.js
├── context/AuthContext.js
├── pages/Login.js|Files.js|Clients.js
└── components/Sidebar.js
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejsscp -i your-key.pem -r ./filevault ec2-user@<EC2-IP>:~/cd ~/filevault/backend
npm install
cp .env.example .env
nano .env # fill in DB_HOST, S3_BUCKET, JWT_SECRET etc.
npm startcd ~/filevault/frontend
npm install
npm run build # creates /build folder
sudo npm install -g serve
serve -s build -l 80 # serve on port 80Or serve frontend from Express (add to server.js):
app.use(express.static(path.join(__dirname, '../frontend/build')));
app.get('*', (req, res) => res.sendFile(path.join(__dirname, '../frontend/build/index.html')));sudo npm install -g pm2
pm2 start ~/filevault/backend/server.js --name filevault-api
pm2 save
pm2 startup| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register | No | Create account |
| POST | /api/auth/login | No | Login, returns JWT |
| GET | /api/files | Yes | List user's files + stats |
| POST | /api/files/upload | Yes | Upload file to S3 |
| DELETE | /api/files/:id | Yes | Delete file record |
| GET | /api/clients | Yes | List clients (paginated) |
| POST | /api/clients | Yes | Add client |
| PUT | /api/clients/:id | Yes | Update client |
| DELETE | /api/clients/:id | Yes | Delete client |
| GET | /health | No | ALB health check |
{
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket"],
"Resource": ["arn:aws:s3:::filevault-uploads-yourname/*"]
}The ALB health check should target GET /health — returns { "status": "ok" }.