A modern blogging platform built with a React frontend and a Hono backend, deployed on Cloudflare Workers. This application leverages TypeScript for type safety and Zod for validation, ensuring a robust development experience.
- Features
- Technologies Used
- Getting Started
- Folder Structure
- Type Validation with Zod
- Database Configuration
- Deployment
- Contributing
- License
- Responsive UI: A clean and user-friendly interface built with React and Tailwind CSS.
- Type Safety: All code is written in TypeScript, providing static type checking.
- Type Validation: Utilizes Zod for runtime type validation, enhancing the reliability of data handling.
- Full-Stack Architecture: A decoupled architecture with a Hono backend and React frontend.
- Database Integration: Uses PostgreSQL with Prisma ORM for seamless database management.
- Connection Pooling: Implements Prisma architecture for connection pooling to optimize database interactions.
- Deployment on Cloudflare Workers: Fast and scalable hosting solution.
- React
- Tailwind CSS
- TypeScript
- Hono
- TypeScript
- Zod (for type validation)
- PostgreSQL
- Prisma ORM
- Cloudflare Workers (via Wrangler)
To set up the project locally, follow these steps:
git clone https://github.com/lokeshjatoth/Medium-Blog.git
cd Medium-Blog# Install frontend dependencies
cd frontend
npm install
# Install backend dependencies
cd ../backend
npm installThis app uses PostgreSQL with Prisma ORM for database management. To set up your database connection:
- Add your connection pool URL and JWT secret in the
wrangler.jsonfile.
# Start the frontend
cd frontend
npm start
# Start the backend
cd ../backend
npm startMedium-Blog/
│── frontend/ # React frontend
│── backend/ # Hono backend
│── prisma/ # Prisma database schema and migrations
│── wrangler.json # Cloudflare Workers configuration
│── package.json # Project dependencies
│── README.md # Documentation
Zod is used for runtime type validation to ensure data integrity. Example usage:
import { z } from 'zod';
const BlogSchema = z.object({
title: z.string(),
content: z.string(),
author: z.string(),
});
const validateBlog = (data: unknown) => {
return BlogSchema.safeParse(data);
};- Prisma is used to manage PostgreSQL.
- Run migrations using:
npx prisma migrate dev --name initTo deploy the application on Cloudflare Workers:
- Install Wrangler CLI:
npm install -g wrangler- Authenticate with Cloudflare:
wrangler login- Deploy the application:
wrangler publishContributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-branch). - Commit your changes (
git commit -m 'Add new feature'). - Push to your branch (
git push origin feature-branch). - Create a pull request.
This project is licensed under the MIT License.