This repository contains a sample project that demonstrates how to use Prisma with PostgreSQL. This project serves as a starting point for building web applications that rely on a PostgreSQL database for data storage.
Follow these steps to get the project up and running on your local machine:
-
Clone the Repository: Clone this repository to your local machine using Git.
git clone https://github.com/Node-AL/prisma-postgresql-without-graphql.git
-
Install Dependencies: Navigate to the project directory and install the required dependencies using npm or yarn.
cd prisma-postgresql-without-graphql npm install # or yarn install
-
Set Up PostgreSQL Database: Create a PostgreSQL database for the project and update the database connection details in the
schema.prisma
file. -
Generate Prisma Client: Generate the Prisma Client by running the following command:
npx prisma generate # or yarn prisma generate
-
Run Migrations: Run Prisma migrations to create the necessary database tables.
npx prisma migrate dev # or yarn prisma migrate dev
-
Build the Application: Build the application using the following command:
npm run build # or yarn build
-
Start the Application: Start the application using the following command:
npm run start # or yarn start
-
Access the Application: The application should now be running locally. Access it in your web browser at
http://localhost:3000
.
The project follows a typical structure for a Node.js application with Prisma. Here are the main directories and their purposes:
- src: Contains the source code for the application.
- controllers: Controllers handle HTTP requests and responses.
- middlewares: Middleware functions for request processing.
- routes: Define routes for the application.
- services: Business logic services.
- index.ts: The main entry point of the application.
- prisma: prisma migration files for database schema changes and mirations.
- package.json: Project dependencies and scripts.
If you find any issues or have suggestions for improvements, please open an issue or create a pull request. Contributions are welcome!
This project was created as a simple starting point for building web applications with Prisma and PostgreSQL . Thanks to the Prisma and PostgreSQL communities for their excellent tools and documentation.
Happy coding!