An open API service indexing awesome lists of open source software.

https://github.com/Rahuletto/evenzo-api

An event management API made with Hono 🔥 with Cloudflare workers, using Cloudflare D1.
https://github.com/Rahuletto/evenzo-api

Last synced: 12 months ago
JSON representation

An event management API made with Hono 🔥 with Cloudflare workers, using Cloudflare D1.

Awesome Lists containing this project

README

          

# Evenzo

An event management API made with [Hono](https://hono.dev/) 🔥 with [Cloudflare workers](https://www.cloudflare.com/developer-platform/workers/), using [Cloudflare D1](https://www.cloudflare.com/developer-platform/d1/). Hono is fast, scalable and works on the edge networks making it zippy.

> Made for SRMKZILLA club submission

## Tech Stack

- **Backend**: Built with Cloudflare Workers.
- **Database**: Utilizes D1 for data management.
- **API Documentation**: Self-documented with OpenAPI and Swagger. `/docs`

## Installation and Setup

> [!TIP]
> If you are not interested in running with the source, you can test it out with the [deployed url](https://evenzo.rameshrahul1974.workers.dev) > `https://evenzo.rameshrahul1974.workers.dev`

### Prerequisites

- [Cloudflare Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/)

### Setup

1. Clone the repository:

```bash
git clone https://github.com/rahuletto/evenzo.git
cd evenzo
```

2. Install Wrangler CLI:

```bash
bun add -g wrangler
```

3. Log in to Cloudflare:

```bash
wrangler login
```

4. Create a Cloudflare D1 database

```bash
wrangler d1 create events_db
```

Have it's id, it is necessary.

5. Configure the database in wrangler.toml:

> Change `example.wrangler.toml` to `wrangler.toml`
> You should use the ID generated by wrangler

```yaml
name = "evenzo"
compatibility_date = "2024-09-28"

[[ d1_databases ]]
binding = "DB"
database_name = "events_db"
database_id = "ID"
```

### Running the app

1. Install all dependencies

```bash
bun install
```

2. Run the dev server

```bash
bun run dev
```

This starts a server at `localhost:8787` (most probably)

3. Deploy the api
To deploy it in your cloudflare workers

```bash
bun run deploy
```

## API Endpoints

`GET /events`
Retrieve all events.

`POST /events`
Create a new event. Requires a JSON body:

```json
{
"title": "Event Title",
"description": "Event Description",
"location": "Event Location",
"time": "2024-10-01T10:00:00Z"
}
```

`GET /events/{id}`
Retrieve an event by its ID.

`PUT /events/{id}`
Update an existing event by its ID. Requires a JSON body with updated details.

`DELETE /events/{id}`
Delete an event by its ID.

## [Documentation](https://evenzo.rameshrahul1974.workers.dev/docs)

The API is documented using OpenAPI. Access the Swagger UI for exploration:

- Swagger UI: `/docs`
- OpenAPI Spec: `/swagger.json`

## License

This project is licensed under the MPL 2.0 License.