A full-stack tech blog built with Node.js, Express, PostgreSQL (backend) and Next.js, Radix UI (frontend).
You can find a live version HERE
- Use authentication with email and password
- Blog posts with infinite scrolling
- Edit and Delete posts (auth required)
- Create comments and reply to other comments!
.
├── backend/ # Express.js + PostgreSQL API
└── next-write/ # Next.js + Radix UI
- Node.js (v18+ recommended)
- npm or yarn
- PostgreSQL instance (local or cloud)
git clone https://github.com/Redesu/NextWrite
cd NextWritecd backend
cp .env.example .env # Create your .env file
npm install
npm run dev # or: npm startWarning
Make sure your PostgreSQL instance is running! Check the schematic script in the last step.
Backend Environment Variables (backend/.env):
DB_HOST=your_db_host
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name
DB_PORT=your_db_port
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=how_long_the_token_expires
REFRESH_TOKEN_EXPIRES_IN=how_long_the_refresh_token_expires
COOKIE_EXPIRES_IN=how_long_the_cookie_expires
cd ../next-write
cp .env.local.example .env.local # Create your .env.local file
npm install
npm run devFrontend Environment Variables (next-write/.env.local):
NEXT_PUBLIC_API_URL=your_api_url
The database uses the following schematic
Create the database schema using the script in script.sql in the root of the backend folder.
- Visit http://localhost:3000 to use the app.
- Login or register to start posting and commenting.
See backend/routes for all available endpoints.
-
POST /api/auth/register– Register user -
POST /api/auth/login– Login user -
POST /api/auth/logout– Logout user -
POST /api/auth/refresh-token– Refresh token (auth required) -
GET /api/auth/me– Get user info (auth required) -
POST /api/comments/:postSlug– Add comment (auth required) -
GET /api/comments/:postSlug– List comments from a post -
POST /api/posts/:postSlug- Add a new post (auth required) -
GET /api/posts- List all posts -
GET /api/posts/:postSlug- Get a single post -
PUT /api/posts/:postSlug- Edit a post (auth required) -
DELETE /api/posts/:postSlug- Delete a post (auth required)
The backend is covered by automated tests using Jest. The test suite includes both unit tests for controllers and integration tests for routes.
└───test
├───integration
│ └───routes
└───unit
└───controllers
├───auth
├───comments
├───middleware
└───posts
To run the full test suite, navigate to the backend directory and run the test command:
cd backend
npm testPull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.





