This project is a Node.js application that integrates with a Neon Postgres database using Drizzle ORM. It provides a simple CRUD (Create, Read, Update, Delete) interface for managing users.
realtime-neon-drizzle
├── src
│ ├── index.js # Entry point of the application
│ ├── db
│ │ ├── client.js # Database client connection
│ │ ├── schema.js # Database schema definition
│ │ └── migrations
│ │ └── 0001_create_users.sql # SQL migration for users table
│ └── controllers
│ └── userController.js # User-related operations
├── scripts
│ └── crud.js # Demonstrates full CRUD lifecycle
├── drizzle.config.js # Drizzle ORM configuration
├── package.json # npm configuration file
├── .env.example # Environment variable template
├── .gitignore # Git ignore file
└── README.md # Project documentation
-
Clone the repository:
git clone <repository-url> cd realtime-neon-drizzle -
Install the dependencies:
npm install -
Create a
.envfile based on the.env.exampletemplate and fill in your database connection details.
-
Start the server:
npm start -
Access the API at
http://localhost:8000.
The src/scripts/crud.js file contains examples of how to perform CRUD operations on the users table. You can run this script to see how to create, read, update, and delete users in the database.
The SQL migration file located at src/db/migrations/0001_create_users.sql is used to create the initial users table. You can run this migration using your preferred database migration tool.
Feel free to submit issues or pull requests for any improvements or features you would like to see in this project.