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

https://github.com/rafaumeu/pocket-api

๐Ÿš€ InOrbit is a high-performance backend built with TypeScript โšก, Fastify ๐Ÿš€, and PostgreSQL ๐Ÿ˜. It features Drizzle ORM ๐Ÿ’พ, JWT authentication ๐Ÿ”, and Docker ๐Ÿณ integration, ensuring seamless deployment and scalability. The platform offers efficient data management ๐Ÿ“Š, authentication ๐Ÿ›ก๏ธ, and goal tracking ๐ŸŽฏ for an enhanced user experience!
https://github.com/rafaumeu/pocket-api

api-docs backend biomejs ci-cd cuid database-migrations docker drizzle fastify gamification high-performance jwt-authentication nodejs orm postgresql rest-api swagger test-coverage typescript zod

Last synced: 3 months ago
JSON representation

๐Ÿš€ InOrbit is a high-performance backend built with TypeScript โšก, Fastify ๐Ÿš€, and PostgreSQL ๐Ÿ˜. It features Drizzle ORM ๐Ÿ’พ, JWT authentication ๐Ÿ”, and Docker ๐Ÿณ integration, ensuring seamless deployment and scalability. The platform offers efficient data management ๐Ÿ“Š, authentication ๐Ÿ›ก๏ธ, and goal tracking ๐ŸŽฏ for an enhanced user experience!

Awesome Lists containing this project

README

        

InOrbit Logo

# InOrbit

A modern TypeScript backend application powered by Fastify and PostgreSQL.

[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
[![Fastify](https://img.shields.io/badge/Fastify-Latest-green.svg)](https://www.fastify.io/)
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-Latest-blue.svg)](https://www.postgresql.org/)
[![Drizzle ORM](https://img.shields.io/badge/Drizzle_ORM-Latest-orange.svg)](https://orm.drizzle.team/)

---

## ๐Ÿ“– Table of Contents

| [โšก Tech Stack](#โšก-tech-stack) | [๐Ÿ›  Development Tools](#๐Ÿ› -development-tools) | [๐Ÿš€ Features](#๐Ÿš€-features) |
|--------------------------------|-----------------------------------------------|----------------------------|
| [๐Ÿ“ฆ Prerequisites](#๐Ÿ“ฆ-prerequisites) | [๐Ÿ› ๏ธ Setup](#๐Ÿ› ๏ธ-setup) | [๐ŸŽฏ API Endpoints](#๐ŸŽฏ-api-endpoints) |
| [๐Ÿ—๏ธ Project Structure](#๐Ÿ—๏ธ-project-structure) | [๐Ÿงช Running Tests](#๐Ÿงช-running-tests) | [๐Ÿ“š API Documentation](#๐Ÿ“š-api-documentation) |
| [๐Ÿ›ก๏ธ License](#๐Ÿ›ก๏ธ-license) | [๐Ÿค Contributing](#๐Ÿค-contributing) | [๐Ÿ”ง Environment Variables](#๐Ÿ”ง-environment-variables) |

---

### โšก Tech Stack

![Node.js](https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-2CA5E0?style=for-the-badge&logo=docker&logoColor=white)
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge&logo=postgresql&logoColor=white)
![Fastify](https://img.shields.io/badge/Fastify-202020?style=for-the-badge&logo=fastify&logoColor=white)

---

### ๐Ÿ›  Development Tools

![Drizzle](https://img.shields.io/badge/Drizzle_ORM-4053D6?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2Z)
![Zod](https://img.shields.io/badge/Zod-3E67B1?style=for-the-badge&logo=zod&logoColor=white)
![Biome](https://img.shields.io/badge/Biome-60A5FA?style=for-the-badge&logo=biome&logoColor=white)
![Day.js](https://img.shields.io/badge/Day.js-F6C915?style=for-the-badge&logo=javascript&logoColor=black)
![CUID2](https://img.shields.io/badge/CUID2-4053D6?style=for-the-badge&logo=uniqueid&logoColor=white)

---

## ๐Ÿš€ Features

- **Modern TypeScript**: Built with the latest TypeScript features for type-safe development
- **High Performance**: Powered by Fastify, one of the fastest web frameworks for Node.js
- **Database Integration**: PostgreSQL with Drizzle ORM for efficient data management
- **Docker Ready**: Containerized setup for consistent development and deployment
- **Developer Experience**: Configured with Biome for linting and formatting
- **ID Generation**: Utilizes CUID2 for unique identifier generation
- **Date Handling**: Efficient date manipulation with Day.js
- **Database Seeding**: Built-in seeding functionality for development and testing
- **Schema Validation**: Request/Response validation with Zod and JSON Schema generation
- **Goals Management**: Complete system for creating and tracking goals with completion status
- **CORS Support**: Enabled with `@fastify/cors` for cross-origin requests
- **Pending Goals and Summaries**: Retrieve and summarize goals for the current week

---

## ๐Ÿ“ฆ Prerequisites

- Node.js (Latest LTS version)
- Docker and Docker Compose
- Yarn package manager

---

## ๐Ÿ› ๏ธ Setup

> ๐Ÿšจ **Important:** Ensure Docker is running before proceeding.

1. Clone the repository:

```bash
git clone https://github.com/rafaumeu/pocket-api.git
cd pocket-api
```

2. Install dependencies:

```bash
yarn install
```

3. Start the PostgreSQL database using Docker:

```bash
docker-compose up -d
```

4. Set up your environment variables:

```bash
cp .env.example .env
```

5. Run database migrations:

```bash
yarn migration:run
```

6. Seed the database (optional):

```bash
yarn seed
```

7. Start the development server:

```bash
yarn dev
```

---

## ๐ŸŽฏ API Endpoints

### Goals

- `POST /goals` - Create a new goal
- `GET /pending-goals` - Retrieve pending goals for the current week
- `POST /completions` - Mark a goal as completed
- `GET /week-summary` - Get a summary of the current week

---

## ๐Ÿ—๏ธ Project Structure

```
inorbit/
โ”œโ”€โ”€ assets/ # Project-related assets
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ db/ # Database configuration and schemas
โ”‚ โ”‚ โ”œโ”€โ”€ index.ts # Database initialization
โ”‚ โ”‚ โ”œโ”€โ”€ schema.ts # Database schema definitions
โ”‚ โ”‚ โ””โ”€โ”€ seed.ts # Database seeding functionality
โ”‚ โ”œโ”€โ”€ functions/ # Business logic
โ”‚ โ”‚ โ”œโ”€โ”€ create-goal.ts
โ”‚ โ”‚ โ”œโ”€โ”€ get-week-pending-goals.ts
โ”‚ โ”‚ โ”œโ”€โ”€ create-goal-completion.ts
โ”‚ โ”‚ โ””โ”€โ”€ get-week-summary.ts
โ”‚ โ”œโ”€โ”€ http/ # HTTP server and route handlers
โ”‚ โ”‚ โ”œโ”€โ”€ routes/ # Separate route handlers
โ”‚ โ””โ”€โ”€ env.ts # Environment variable configuration
โ”œโ”€โ”€ .migrations/ # Database migration files
โ”œโ”€โ”€ drizzle.config.ts # Drizzle ORM configuration
โ”œโ”€โ”€ biome.json # Biome linting and formatting config
โ””โ”€โ”€ docker-compose.yml
```

---

## ๐Ÿงช Running Tests

```bash
yarn test
```

---

## ๐Ÿ“š API Documentation

API documentation is available at `http://localhost:3000/docs` when running the development server. The documentation includes request/response schemas generated from Zod definitions.

---

## ๐Ÿ›ก๏ธ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## ๐Ÿค Contributing

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'feat: add some amazing feature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

---

## ๐Ÿ”ง Environment Variables

```env
DATABASE_URL=postgresql://user:password@localhost:5432/inorbit
PORT=3000
```

---


Made with โค๏ธ by Rafael Dias Zendron


### Built with ๐Ÿ’œ by Rafael Zendron

[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/rafael-dias-zendron-528290132/)
[![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/rafaumeu)