- Introduction
- Features
- Technologies
- Installation
- Usage
- API Docs SWAGGER
- API Endpoints
- Testing
- Contributing
- License
This is the backend service for a full-stack PERN (PostgreSQL, Express, React, Node.js) application built with TypeScript. The service provides a robust RESTful API with database integration using Sequelize ORM, authentication, and comprehensive documentation.
- RESTful API architecture
- PostgreSQL database integration with Sequelize ORM
- User authentication and authorization (JWT)
- TypeScript for enhanced type safety and developer experience
- Database migrations and seeders
- Input validation and sanitization
- Error handling middleware
- API documentation with Swagger
- Comprehensive testing setup
- Security features implementation
- CORS configuration
- Environment-based configurations
- Node.js
- Express.js
- TypeScript
- PostgreSQL
- Sequelize ORM
- Axios
- JWT for authentication
- Bcrypt for password hashing
- Jest & Supertest for testing
- Swagger UI Express for API documentation
- Winston for logging
- ESLint & Prettier
- Cors
- Helmet for security
- Clone the repository:
git clone https://github.com/fer8614/Product-Manager- Navigate to server directory:
cd fullstack_node_react_typescript/server- Install dependencies:
npm install- Create
.envfile in server root directory:
DATABASE_URL=your_database_name
FROONTEND_URL=your_frontend_user- Configure database:
# Run migrations
npm run migrate
# Run seeders (if any)
npm run seedDevelopment mode:
npm run devBuild project:
npm run buildDatabase commands:
# Create migration
npm run migrate:create name_of_migration
# Undo last migration
npm run migrate:undo
# Create seeder
npm run seed:create name_of_seederAccess Swagger documentation at:
http://localhost:4000/api-docs
The documentation includes:
- Detailed endpoint descriptions
- Request/Response schemas
- Authentication requirements
- Example requests
- Error responses
POST /api/auth/register - Register new user
POST /api/auth/login - Login user
POST /api/auth/logout - Logout user
GET /api/users - Get all users
GET /api/users/:id - Get user by ID
PUT /api/users/:id - Update user
DELETE /api/users/:id - Delete user
GET /api/products - Get all products
POST /api/products - Create product
GET /api/products/:id - Get product by ID
PUT /api/products/:id - Update product
DELETE /api/products/:id - Delete product
Protected routes require JWT token in header:
Authorization: Bearer <token>
Run unit tests:
npm run testRun integration tests:
npm run test:integrationGenerate coverage report:
npm run test:coverage- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Contribution Guidelines:
- Follow TypeScript best practices
- Write tests for new features
- Update documentation as needed
- Follow existing code style
- Use meaningful commit messages
This project is licensed under the MIT License - see the LICENSE.md file for details.