Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 7 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Node.js dependencies
**/node_modules/

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# Environment files
**/.env
**/.env.*

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
# Operating system files
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
Thumbs.db
59 changes: 19 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,30 @@
# Next.js developer exercise
# Full-Stack Project

© 2026 Renderbit Technologies Pvt. Ltd.
This repository contains both the frontend and backend applications for the project.

## Prerequisites
## Project Structure

You should be familiar with Node.js, React, Next.js, Git and GitHub.
- `frontend/` - React + Vite frontend application
- `backend/` - Express backend server and APIs

## Getting Started

This tutorial assumes you have a Node.js development environment set up on your machine, with the following components at minimum:
### Frontend

1. Node.js 20 or better
2. Choice of package manager (npm/Yarn/pnpm)
3. Choice of Database (MySQL/MariaDB/PostgreSQL/SQLite)
4. Choice of IDE/Editor
```bash
cd frontend
npm install
npm run dev
```

Fork this repository, and clone your fork locally. All submissions have to be made as a pull request against this repository.
### Backend

## Requirements
```bash
cd backend
npm install
node server.js
```

You have to design a blogging application.
## Environment Variables

Any user can sign up and create a blog of their own. When signing up, you have to record the user's full name, unique email address, password (8 characters minimum with 1 special character required) and choice of unique username.

The homepage of the blog can be viewed by anyone without login. The homepage shall show a list of all blog posts by all users, with most recent posts on top. The list of blog posts shall be paginated, with 8 posts per page. On clicking a post, a user can view the entire post content.

Every user shall have his/her blog home page at `<sitename>/<username>`. This page shall show a list of all posts by the particular user, with most recent posts on top. This list of blog posts shall also be paginated, with 8 posts per page. On clicking a post, a user can view the entire post content.

A blog post has the URL `<sitename>/<username>/<post_unique_slug_from_title>`. A blog post has a post title and post content. Anyone can view a blog post without login. However, you need to login to comment on a blog post. Any user can comment on any blog post. However, a user can only delete comments that he has made on other users' blog posts. The author of the blog post can delete any comment on the blog post made by any user. The comments are shown below the blog post content, with most recent comments on top. A form to add a new comment is shown above the comments thread.

Every user can access the admin panel at `<sitename>/admin`. A user has to login to access the admin panel. The admin panel should show a list of all posts, with an option to edit and delete each post. The admin panel should also have an option to create a new post.

### UI

You are free to use any UI framework or library of your choice. We recommend [Tailwind CSS](https://tailwindcss.com) (already set up in this starter) or a component library such as [shadcn/ui](https://ui.shadcn.com) as a good place to get started.

Note that you are not required to build a mobile responsive website, although if you build one, we will be assigning extra credits for that.

### Libraries & Frameworks

You are free to use any libraries, frameworks & tools which you think will be useful to build this application. No credits are deducted for use of libraries. This includes your choice of database driver or ORM (such as [Prisma](https://www.prisma.io) or [Drizzle](https://orm.drizzle.team)) and your choice of authentication approach (such as [NextAuth.js](https://next-auth.js.org)/Auth.js, [Lucia](https://lucia-auth.com), or a custom implementation).

### Extra Credits

- Implement a social login feature which allows users to login and sign up via their Google/Facebook/Twitter/GitHub accounts.
- Allow photos to be inserted into blog posts.
- Allow WYSIWYG editing of blog posts with rich formatting support.
- Implement a CAPTCHA for adding comments.
- Implement two-factor authentication for login using SMS for one-time passwords.
- Surprise us. :smiley:
Create local `.env` files inside the `frontend` and `backend` folders and keep any secrets there. These files are ignored by git.
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

npm-debug.log*
20 changes: 20 additions & 0 deletions backend/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { Pool } = require("pg");
require("dotenv").config();

const pool = new Pool({
host: process.env.DB_HOST,
port: process.env.DB_PORT,
database: process.env.DB_NAME,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
});

pool.on("connect", () => {
console.log("Connected to PostgreSQL");
});

pool.on("error", (err) => {
console.error("PostgreSQL connection error:", err);
});

module.exports = pool;
Loading