Medium-app is a React frontend and Cloudflare workers backend application offering features replicating Medium, the popular blogging platform. The application comes with JWT authentication, Postgres database, and various user features.
- Users can sign up and sign in securely via token-based authentication.
- Users can view all published articles.
- Users can create, edit, and delete their articles.
- Users can view details of specific articles.
- Users can search for articles.
- Users have the option to filter and paginate through articles.
(More features TBA)
The application is built with the following technologies:
- React for the frontend.
- Cloudflare Workers for the serverless backend.
- Zod for validation library and TypeScript type inference.
- TypeScript as the main programming language.
- Prisma with connection pooling as the ORM.
- Postgres as the database.
- JSON Web Tokens (JWT) for authentication.
The project is structured into the following directories:
- Backend: Contains server-side code and logic.
- Common: Shared assets and modules used by frontend and backend. (NPM Library)
- Frontend: Contains client-side code and logic.
- Navigate into the backend directory
cd backend
- Set up Postgres DATABASE_URL in .env. You can get a free PostgreSQL connection string from Aiven.io.
- Set up Prisma connection pool DATABASE_URL in wrangler.toml file. You can get this for free from Prisma.
- Set up JWT Secret JWT_SECRET in wrangler.toml file. This can be any value.
- Install dependencies using
npm install
- Run the application locally using
npm run dev
Note: wrangler.toml is the environment configuration file for a serverless backend. .env is used by Prisma for connection pooling. Ensure you configure both environment files accordingly.
- Navigate into the frontend directory using
cd frontend
- Install dependencies using
npm install
- Run the application locally using
npm run dev
- ReactJS
- Typescript
- Cloudflare Workers - Serverless Backend
- Aiven.io - PostgreSQL Database
- Prisma - ORM
- Hono - Small, simple, and ultra-fast web framework for the edges.
- Zod - TypeScript-first schema validation with static type inference
For detailed steps to deploy the application, refer to backend/commands.md
and common/commands.md
in their respective directories.