A full-stack blog application built with NextJS, Flask, and PostgreSQL.
- Create, read, update, and delete blog posts
- Search functionality for blog posts
- Pagination for better user experience
- Responsive user interface
- RESTful API
- Python (Flask)
- PostgreSQL database
- TypeScript
- NextJS
- Tailwind CSS
- Navigate to the backend directory:
cd backend- Create a virtual environment and activate it:
python -m venv .venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install the required packages:
pip install -r requirements.txt- Set up environment variables:
touch .envEdit the .env file to include your PostgreSQL credentials.
- Run database migrations:
flask db upgrade- Seed the database:
flask seed-db- Start the backend server:
flask run- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Set up environment variables:
touch .env.localEdit the .env.local file to point to your backend API.
- Start the development server:
npm run dev- Open http://localhost:3000 in your browser
GET /api/posts- Get all blog posts (supports pagination and search)GET /api/posts/:id- Get a specific blog postPOST /api/posts- Create a new blog postPUT /api/posts/:id- Update a blog postDELETE /api/posts/:id- Delete a blog post
├── backend/ # Flask backend
│ ├── app/
│ │ ├── models/ # Database models
│ │ ├── routes/ # API routes
│ │ ├── schemas/ # Request/response schemas
│ │ └── utils/ # Utility functions
│ ├── migrations/ # Database migrations
│ ├── tests/ # Backend tests
│ ├── .env.example # Example environment variables
│ ├── requirements.txt # Python dependencies
│ └── run.py # Entry point
├── frontend/ # NextJS frontend
│ ├── app/ # Next.js 13+ App Router
│ ├── components/ # Reusable UI components
│ ├── lib/ # Utility functions
│ ├── public/ # Static assets
│ ├── .env.example # Example environment variables
│ └── package.json # JavaScript dependencies
└── README.md # Project documentation
MIT