deploying a CMS System with NestJS, Prisma, PostgreSQL and Google Drive
In this article, we will introduce how to build a simple Content Management System (CMS) using NestJS, Prisma, PostgreSQL, TypeScript, and Google Drive, and deploy it to Vercel. This CMS system includes user authentication, article management, and image upload functionalities.
Tech Stack
- NestJS: A framework for building efficient, scalable Node.js server-side applications.
- Prisma: A modern database toolkit that simplifies database access and management.
- PostgreSQL: A powerful open-source relational database management system.
- TypeScript: A programming language that adds static types to JavaScript.
- Google Drive: A cloud storage service for storing and managing images.
- Vercel: A deployment platform for frontend and full-stack applications.
System Features
- User Authentication: Implement user registration, login, and role-based access control.
- Article Management: Implement article creation, editing, deletion, and viewing functionalities.
- Image Upload: Implement image upload to Google Drive and use in articles.
Project Structure
my-nestjs-project/
├── dist/
├── prisma/
│ ├── schema.prisma
├── src/
│ ├── auth/
│ │ ├── auth.controller.ts
│ │ ├── auth.module.ts
│ │ ├── auth.service.ts
│ │ ├── jwt.strategy.ts
│ │ └── roles.guard.ts
│ ├── articles/
│ │ ├── articles.controller.ts
│ │ ├── articles.module.ts
│ │ ├── articles.service.ts
│ ├── media/
│ │ ├── media.service.ts
│ ├── main.ts
├── vercel.json
├── package.json
├── tsconfig.json
├── .env
└── ...
Implementation Details
- User Authentication Implement user authentication and role-based access control in the auth directory.
- Article Management Implement article creation, editing, deletion, and viewing functionalities in the src/articles directory.
- Image Upload to Google Drive Implement image upload functionality in the media directory.
Deploying to Vercel
- Install Vercel CLI:
npm install -g vercel
- Login to Vercel:
vercel login
- Deploy the Project: In the project root directory, run the following command:
vercel --prod
- Select Project Settings:
- Select the project to deploy.
- Choose the team to use (if applicable).
- Confirm the project settings.
Conclusion
By using NestJS, Prisma, PostgreSQL, TypeScript, and Google Drive, we have built a simple CMS system and successfully deployed it to Vercel. This project demonstrates how to integrate multiple technologies to create a complete application.
Source Code and Star Link
- GitHub Source Code
- If you find this project helpful, please give us a star!
We hope this article helps you understand how to build and deploy a full-fledged application using these technologies. If you have any questions or suggestions, feel free to leave a comment.