This is a blogging platform where users can get blogs in bulk, publish posts, edit blogs, and use tags on particular blog posts. The project consists of a backend built using TypeScript with the HonoJS framework for Cloudflare Workers (serverless backends) and a frontend built using Tailwind CSS, ReactJS, and TypeScript. It also includes a common folder with all the Zod types published on npm.
backend
: Contains the backend code written in TypeScript using HonoJS, Prisma ORM, and deployed on Cloudflare Workers.frontend
: Contains the frontend code written in React with Tailwind CSS and TypeScript.common
: Contains all the Zod types, published as an npm package.
- Node.js (v14.x or later)
- Cloudflare account
- Docker (optional, for containerized setup)
-
Clone the repository
git clone [email protected]:NitinGurawaliya/medium.git cd medium/backend
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env
file in thebackend
folder and add the following environment variables:DATABASE_URL="postgresql://user:password@localhost:5432/blogdb"
-
Generate Prisma Client
npx prisma generate
-
Run database migrations
npx prisma migrate dev
-
Start the development server
npm run dev
-
Deploy to Cloudflare Workers
npm run deploy
-
Navigate to the frontend directory
cd ../frontend
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Build the frontend for production
npm run build
-
Preview the production build
npm run preview
npm run dev
: Start the development server using Wrangler.npm run deploy
: Deploy the backend to Cloudflare Workers with minification.
npm run dev
: Start the development server using Vite.npm run build
: Build the frontend for production.npm run preview
: Preview the production build.npm run lint
: Run ESLint for code linting.
- TypeScript
- HonoJS framework
- Cloudflare Workers
- Prisma ORM
- React
- Tailwind CSS
- TypeScript
- Axios for API requests
- React Router for routing
- Zod for schema validation (published on npm as
@nitin2024/medium-common
)
-
Install Wrangler CLI
npm install -g wrangler
-
Authenticate Wrangler with Cloudflare
wrangler login
-
Deploy the backend
npm run deploy
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
This project is licensed under the ISC License.