Skip to content

Commit 20bcf52

Browse files
committed
Initial dev commit
0 parents  commit 20bcf52

File tree

126 files changed

+25170
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+25170
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy CV Builder
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 20
19+
20+
- name: Build frontend
21+
working-directory: ./frontend
22+
run: |
23+
npm install
24+
npm run build
25+
26+
- name: Deploy to server via SSH
27+
uses: appleboy/ssh-action@v0.1.9
28+
with:
29+
host: ${{ secrets.SERVER_IP }}
30+
username: ${{ secrets.SERVER_USER }}
31+
key: ${{ secrets.SERVER_SSH_KEY }}
32+
script: |
33+
cd ~/next-steps-cv-builder
34+
git pull origin main
35+
cd frontend
36+
npm install
37+
npm run build
38+
sudo rm -rf /var/www/html/*
39+
sudo cp -r dist/* /var/www/html/
40+
cd ../backend
41+
npm install
42+
pm2 restart backend
43+
sudo systemctl reload nginx

backend/.gitignore

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Microbundle cache
58+
.rpt2_cache/
59+
.rts2_cache_cjs/
60+
.rts2_cache_es/
61+
.rts2_cache_umd/
62+
63+
# Optional REPL history
64+
.node_repl_history
65+
66+
# Output of 'npm pack'
67+
*.tgz
68+
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
# dotenv environment variables file
73+
.env
74+
.env.test
75+
.env.production
76+
77+
# parcel-bundler cache (https://parceljs.org/)
78+
.cache
79+
.parcel-cache
80+
81+
# Next.js build output
82+
.next
83+
out
84+
85+
# Nuxt.js build / generate output
86+
.nuxt
87+
dist
88+
89+
# Gatsby files
90+
.cache/
91+
# Comment in the public line in if your project uses Gatsby and not Next.js
92+
# https://nextjs.org/blog/next-9-1#public-directory-support
93+
# public
94+
95+
# vuepress build output
96+
.vuepress/dist
97+
98+
# Serverless directories
99+
.serverless/
100+
101+
# FuseBox cache
102+
.fusebox/
103+
104+
# DynamoDB Local files
105+
.dynamodb/
106+
107+
# TernJS port file
108+
.tern-port
109+
110+
# Stores VSCode versions used for testing VSCode extensions
111+
.vscode-test
112+
113+
# yarn v2
114+
.yarn/cache
115+
.yarn/unplugged
116+
.yarn/build-state.yml
117+
.yarn/install-state.gz
118+
.pnp.*
119+
120+
# End of https://mrkandreev.name/snippets/gitignore-generator/#Node

backend/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:18-alpine
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
RUN npm install
7+
8+
COPY . .
9+
10+
EXPOSE 5000
11+
12+
CMD ["npm", "start"]

backend/Readme.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Next Steps CV Builder - Backend API
2+
3+
This backend provides RESTful APIs for user management and CV creation, built with Express.js and MongoDB.
4+
5+
## Base URL
6+
7+
```
8+
{will be updated}
9+
```
10+
11+
## Endpoints
12+
13+
### User APIs (`/api/users`)
14+
15+
- `POST /api/users/register`
16+
Register a new user.
17+
**Body:** `{ fullName, email, password, ... }`
18+
19+
- `POST /api/users/login`
20+
Authenticate user and return a token.
21+
**Body:** `{ email, password }`
22+
23+
- `GET /api/users/profile`
24+
Get logged-in user's profile.
25+
**Auth required**
26+
27+
### CV APIs (`/api/cv`)
28+
29+
- `POST /api/cv/save`
30+
Save or update user's CV.
31+
**Body:** `CV data object`
32+
33+
- `GET /api/cv/:userId`
34+
Get CV for a specific user.
35+
36+
- `POST /api/cv/upload`
37+
Upload CV file (PDF, DOC, DOCX).
38+
**Form Data:** `file`
39+
40+
## File Uploads
41+
42+
- Uses [Multer](https://github.com/expressjs/multer) for file uploads.
43+
- Supports GridFS for storing files in MongoDB.
44+
45+
## Setup
46+
47+
1. Clone the repo.
48+
2. Install dependencies:
49+
```bash
50+
npm install
51+
```
52+
3. Set environment variables in `.env` (see `.env.example`).
53+
4. Start the server:
54+
```bash
55+
npm start
56+
```
57+
58+
## License
59+
60+
MIT

backend/app.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import express from 'express';
2+
import cors from 'cors';
3+
import cookieParser from 'cookie-parser';
4+
import dotenv from 'dotenv';
5+
dotenv.config();
6+
7+
const app = express();
8+
9+
app.use(cors({
10+
origin: '*',
11+
credentials: true
12+
}));
13+
app.use(express.json());
14+
app.use(cookieParser());
15+
app.use(express.urlencoded({ extended: true }));
16+
app.use(express.static('public'));
17+
18+
import userRoutes from './src/routes/user.routes.js';
19+
import cvRoutes from './src/routes/cv.routes.js';
20+
import conferenceRoutes from './src/routes/conference.routes.js';
21+
import FileRoutes from './src/routes/file.routes.js';
22+
import workshopRoutes from './src/routes/workshop.routes.js';
23+
import EMRTrainingRoutes from './src/routes/emrTraining.routes.js';
24+
import PublicationsRoutes from './src/routes/publication.routes.js';
25+
26+
27+
28+
// app.use('/api/files', FileRoutes);
29+
app.use('/api/users', userRoutes);
30+
app.use('/api/cv', cvRoutes);
31+
app.use('/api/conferences', conferenceRoutes);
32+
app.use('/api/workshops', workshopRoutes);
33+
app.use('/api/documents', FileRoutes);
34+
app.use('/api/emr-training', EMRTrainingRoutes);
35+
app.use('/api/publications', PublicationsRoutes);
36+
37+
export { app };

0 commit comments

Comments
 (0)