Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/varsharani9/blogging-application
This is an application that allows users to sign up, log in, create, and read blog posts. The application features JWT-based authentication and leverages a serverless backend.
https://github.com/varsharani9/blogging-application
cloudflare-workers hono jwt prisma reactjs tailwindcss zod
Last synced: 25 days ago
JSON representation
This is an application that allows users to sign up, log in, create, and read blog posts. The application features JWT-based authentication and leverages a serverless backend.
- Host: GitHub
- URL: https://github.com/varsharani9/blogging-application
- Owner: VarshaRani9
- Created: 2024-08-01T03:03:05.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-20T05:27:08.000Z (3 months ago)
- Last Synced: 2024-10-04T22:11:35.823Z (about 1 month ago)
- Topics: cloudflare-workers, hono, jwt, prisma, reactjs, tailwindcss, zod
- Language: TypeScript
- Homepage:
- Size: 115 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blogging Application
This is a full-fledged blogging application that allows users to sign up, log in, create, and read blog posts. The application features JWT-based authentication and leverages a serverless backend.## Features
- User authentication (sign up and sign in)
- Create, read blog posts
- Fetch multiple blog posts
- JWT-based authentication
- Modular route structure
- Prisma for database ORM
- Zod validation for data integrity## Technology Used
- Backend: Cloudflare Workers, Hono, Prisma, PostgreSQL
- Frontend: React.js, Tailwind CSS
- Validation: Zod (shared between frontend and backend)
- Database: Neon PostgreSQL
- Deployment: Vercel, Cloudflare Workers
- Miscellaneous: JWT for authentication, npm for package management## Installation
Clone the Repository:
```
git clone https://github.com/VarshaRani9/Blogging_Application.gitcd Blogging_Application
```### Backend Setup:
Navigate to the backend directory:
```
cd backend
```Install dependencies:
```
npm install
```Initialize Prisma and migrate the database:
npx prisma migrate dev --name init_schema
### Frontend Setup:
Navigate to the frontend directory:
```
cd ../frontend
```Install dependencies:
```
npm install
```### Common Package Setup:
Navigate to the common directory:
```
cd ../common
```Install dependencies and publish to npm:
```
npm installnpm publish
```### Usage
#### Run Backend:Navigate to the backend directory:
```
cd backend
```Start the development server:
```
npm run dev
```#### Run Frontend:
Navigate to the frontend directory:
```
cd ../frontend
```Start the development server:
```
npm run dev
```#### Access the Application:
Open your browser and go to http://localhost:3000.
## Routes and Endpoints
### User RoutesSign Up:
```
URL: /api/v1/user/signup
Method: POST
Body:
{
"email": "[email protected]",
"password": "password123"
}
```Sign In:
```
URL: /api/v1/user/signin
Method: POST
Body:
{
"email": "[email protected]",
"password": "password123"
}
```### Blog Routes
Create Blog:
```
URL: /api/v1/blog
Method: POST
Headers:
{
"Authorization": "Bearer "
}
Body:
{
"title": "My First Blog",
"content": "This is the content of my first blog."
}
```Update Blog:
```
URL: /api/v1/blog
Method: PUT
Headers:
{
"Authorization": "Bearer "
}
Body:
{
"id": "blog-id",
"title": "Updated Title",
"content": "Updated content."
}
```Fetch Blog by ID:
```
URL: /api/v1/blog/:id
Method: GET
```Fetch All Blogs:
```
URL: /api/v1/blog/bulk
Method: GET
```#### Common Package
The common package contains shared Zod validations to ensure data integrity across both the frontend and backend. This package is published on npm and can be installed as a dependency in both projects.Installation:
```
npm install @your-org/common
```Usage Example:
```
import { userSchema } from '@your-org/common';// Use in validation
const userData = userSchema.parse(requestBody);
```