Skip to content

exprays/rocket

Repository files navigation

Rocket 🚀

A Typesafe, lightning-fast, high-performance API built using Hono and cloudflare workers which searches countries in milliseconds.

It uses distriuted databases and cloudflare workers to provide superfast query messages throughout the world with the help of upstash. You can also switch database options between Redis & Serverless PostgreSQL.

API Reference

Get all items

  GET /api/search
Parameter Type Description
query string[] Required. Country name to search
source redis or postgres Database to use

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

UPSTASH_REDIS_URL - Your upstash redis database url

UPSTASH_REDIS_TOKEN - Your upstash redis token

NEON_POSTGRES_URL - Your postgreSQL database url string ( For this I used NeonDB )

Run Locally

Clone the project

  git clone https://github.com/rayxlab/rocket.git

Go to the project directory

  cd rocket

Install dependencies

  npm install or pnpm install

Start the server

  npm run dev or pnpm dev

Deployment

To deploy this project run

  npm run deploy

Note: To deploy this project to cloudflare workers you have to add this wrangler.toml file to your root directory before deploying.

name = "rocket"
compatibility_date = "2024-04-02"

[vars]
UPSTASH_REDIS_URL="Your_redis_url"
UPSTASH_REDIS_TOKEN="Your_redis_token"
NEON_POSTGRES_URL="Your postgreSQL url"

Features

  • Fast searches
  • Shows duration of searches
  • Uses full-text RediSearch©️ algorithm
  • Uses superfast serverless postgreSQL search
  • Database switching

License

MIT

💻 Tech Used:

Redis Cloudflare Next JS Hono Upstash Postgresql