A RESTful API for the Bestflix frontend with JWT authentication, Neon-backed profiles and favorites, and a movie catalog served from the existing export.
- User authentication and authorization using JWT
- Movie catalog lookups for the frontend
- User profile management
- Favorite movies per user stored in Neon
- Cross-Origin Resource Sharing (CORS) enabled
- API documentation using JSDoc
- Node.js
- Express.js
- PostgreSQL / Neon
- Passport.js (JWT)
- JSDoc for documentation
- Clone the repository:
git clone <repository-usl>- Install dependencies:
npm install- Create a .env file with:
DATABASE_URL=your_neon_connection_string
JWT_SECRET=your_jwt_secret
FRONTEND_URL=https://your-bestflix-react-app.netlify.app- Start the server:
npm start- Active server files:
neonServer.js,neonAuth.js,neonPassport.js,neonDatabase.js,middleware.js,index.js - Archived legacy files: moved to
_Archived/to keep the repo tidy (these contain the previous MongoDB/Mongoose implementation):auth.js,database.js,models.js,passport.js,routes/movies.js,routes/users.js.
If you need to inspect the older MongoDB-based implementation, see the _Archived/ folder.
The docs/ folder contains JSDoc-generated HTML from an earlier version of the project. Some pages document archived files.
To regenerate up-to-date docs for the current codebase (requires jsdoc):
npm install
npm run docsAfter running npm run docs, open docs/index.html in your browser to view the documentation.
DATABASE_URL— Neon/Postgres connection string used byneonDatabase.jsJWT_SECRET— Secret for signing JWTsFRONTEND_URL— Allowed frontend origin for CORS- Frontend apps should use
REACT_APP_API_URLpointing to this API (e.g.http://localhost:3001)
GET /api/movies- Get all movies (requires authentication)GET /api/movies/:Title- Get movie by titleGET /api/movies/Director/:Name- Get movie by directorGET /api/movies/Genre/:Name- Get movie by genre
POST /api/auth/signup- Register new userPOST /api/auth/login- User loginPOST /api/auth/logout- User logout
GET /api/users- List usersGET /api/users/:identifier- Get the signed-in user profilePUT /api/users/:identifier- Update user infoDELETE /api/users/:identifier- Delete user profile
GET /api/favorites/:userId- List favorites for a userPOST /api/favorites- Add a favorite movieDELETE /api/favorites- Remove a favorite movie
npm start- Start the servernpm run dev- Start with nodemonnpm run docs- Generate documentation
- express - Web framework
- pg - PostgreSQL client for Neon
- passport - Authentication
- jsonwebtoken - JWT implementation
- bcrypt - Password hashing
- nodemon - Development server
- jsdoc - Documentation generator
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License