This is a full-stack blogging application built with a modern tech stack. It includes a backend API, a frontend user interface, and a shared module for common code between the two.
The project is organized into three main directories:
backend
: Contains the server-side code, built with Hono and Cloudflare Workers. ⚙️frontend
: Contains the client-side code, built with React and Vite. 🖼️comman-app
: A shared module that contains common code used by both the frontend and backend, such as validation schemas. 🤝
- Hono: A small, fast, and feature-rich web framework for the edge. 🔥
- Cloudflare Workers: Serverless execution environment for running the backend code. ☁️
- Prisma: A next-generation ORM for Node.js and TypeScript. 🗄️
- PostgreSQL: The database used for this project. 🐘
- JWT: For user authentication. 🔐
- React: A JavaScript library for building user interfaces. ⚛️
- Vite: A fast and modern build tool for web development. ⚡
- TypeScript: A typed superset of JavaScript. ⌨️
- Tailwind CSS: A utility-first CSS framework. 🎨
- Axios: A promise-based HTTP client for the browser and Node.js. 🌐
- React Router: For handling routing in the React application. 🗺️
- Zod: A TypeScript-first schema declaration and validation library. ✅
- Node.js and npm (or yarn) installed on your machine.
- A Cloudflare account with Wrangler CLI configured.
- A PostgreSQL database.
- Navigate to the
backend
directory:cd backend
- Install dependencies:
npm install
- Configure environment variables:
Create a
.dev.vars
file in thebackend
directory and add the following variables:DATABASE_URL="your-database-url" JWT_SECRET="your-jwt-secret"
- Run the backend server:
npm run dev
- Navigate to the
frontend
directory:cd frontend
- Install dependencies:
npm install
- Run the frontend development server:
npm run dev
npm run dev
: Starts the backend server in development mode.npm run deploy
: Deploys the backend to Cloudflare Workers.
npm run dev
: Starts the frontend development server.npm run build
: Builds the frontend for production.npm run lint
: Lints the frontend code.npm run preview
: Previews the production build of the frontend.