Skip to content

th310rd/filevault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

FileVault — AWS Final Project

Full-stack file storage app. Node.js/Express backend + React frontend, connected to RDS PostgreSQL and Amazon S3.

Project structure

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

Setup on EC2

1. Install Node.js (if not already)

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

2. Clone/upload your code to EC2

scp -i your-key.pem -r ./filevault ec2-user@<EC2-IP>:~/

3. Backend setup

cd ~/filevault/backend
npm install
cp .env.example .env
nano .env   # fill in DB_HOST, S3_BUCKET, JWT_SECRET etc.
npm start

4. Frontend build & serve

cd ~/filevault/frontend
npm install
npm run build           # creates /build folder
sudo npm install -g serve
serve -s build -l 80    # serve on port 80

Or 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')));

5. Run backend on startup (PM2)

sudo npm install -g pm2
pm2 start ~/filevault/backend/server.js --name filevault-api
pm2 save
pm2 startup

API endpoints

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

EC2 IAM role permissions needed

{
  "Effect": "Allow",
  "Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket"],
  "Resource": ["arn:aws:s3:::filevault-uploads-yourname/*"]
}

ALB health check

The ALB health check should target GET /health — returns { "status": "ok" }.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors