A modern backend API for managing architecture portfolios, built with Node.js and NestJS.
This backend service provides a comprehensive API for managing architecture portfolios with the following features:
- Portfolio Management: Create, read, update, and delete portfolio entries with multilingual support
- Media Handling: Support for images and videos with file upload capabilities
- Authentication: JWT-based authentication system
- Multilingual Content: Support for English and French content
- Static File Serving: Serve uploaded media files
- Database: MongoDB with Prisma ORM
- RESTful API: Clean and intuitive API endpoints
- JWT Authentication: Secure user authentication and authorization
- File Upload: Handle image and video uploads with Multer
- Multilingual Support: JSON-based content management for multiple languages
- Database Integration: MongoDB with Prisma for type-safe database operations
- Static File Serving: Serve uploaded media files through dedicated endpoints
- Node.js (v18 or higher)
- MongoDB database
- npm or yarn package manager
- Clone the repository:
git clone <repository-url>
cd backend- Install dependencies:
npm install- Set up environment variables:
Create a
.envfile in the root directory with the following variables:
DATABASE_URL="mongodb://localhost:27017/architecture-portfolio"
JWT_SECRET="your-jwt-secret-key"
PORT=3000- Set up the database:
# Generate Prisma client
npx prisma generate
# Run database migrations (if using migrations)
npx prisma db push# Development mode
npm run start:dev
# Production mode
npm run start:prod
# Debug mode
npm run start:debugThe application will be available at http://localhost:3000
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
# Watch mode
npm run test:watchsrc/
├── auth/ # Authentication module
│ ├── auth.controller.ts
│ ├── auth.service.ts
│ └── jwt.strategy.ts
├── portfolio/ # Portfolio management module
│ ├── interfaces/
│ ├── portfolio.controller.ts
│ └── portfolio.service.ts
├── app.controller.ts # Main application controller
├── app.service.ts # Main application service
├── app.module.ts # Root module
├── main.ts # Application entry point
└── logger.service.ts # Logging service
The application uses MongoDB with the following main models:
- Portfolio: Portfolio entries with multilingual content and media
- ContactUs: Contact information with multilingual support
- AboutUs: About us content with multilingual support
POST /auth/login- User loginPOST /auth/register- User registration
GET /api/portfolios- Get all portfoliosGET /api/portfolios/:id- Get portfolio by IDPOST /api/portfolios- Create new portfolioPUT /api/portfolios/:id- Update portfolioDELETE /api/portfolios/:id- Delete portfolio
GET /uploads/:filename- Serve uploaded media files
# Lint code
npm run lint
# Format code
npm run format# Generate Prisma client
npx prisma generate
# Push schema changes to database
npx prisma db push
# Open Prisma Studio
npx prisma studio- @nestjs/common: NestJS core framework
- @nestjs/jwt: JWT authentication
- @nestjs/passport: Passport integration
- @prisma/client: Database ORM
- bcryptjs: Password hashing
- multer: File upload handling
- @nestjs/cli: NestJS CLI tools
- prisma: Database schema management
- typescript: TypeScript support
- jest: Testing framework
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue in the repository or contact the development team.