Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/mkloz/usof-backend

Reddit-like app ExpressJS API. https://api.mkloz.online/usof/api/docs/
https://github.com/mkloz/usof-backend

aws-s3 azure cron expressjs mysql open-api prisma swagger-ui zod

Last synced: 17 days ago
JSON representation

Reddit-like app ExpressJS API. https://api.mkloz.online/usof/api/docs/

Awesome Lists containing this project

README

        





USOF


Reddit-like application express API



license
last-commit
repo-top-language
repo-language-count



Developed with the software and tools below.



YAML
Nodemon
ESLint
TypeScript
Prisma
Docker
Express
JSON
Node.js
MySQL
Zod
Prettier
Azure
Swagger
OpenAPI
AWS S3



## 🔗 Quick Links

> - [📍 Overview](#-overview)
> - [🚀 Getting Started](#-getting-started)
> - [⚙️ Installation](#️-installation)
> - [🗄️ Database Setup](#️-database-setup)
> - [🤖 Running USOF](#-running-USOF)
> - [📜 Swagger Documentation](#-swagger-documentation)
> - [🗄️ Database Schema](#️-database-schema)
> - [🤝 Contributing](#-contributing)
> - [📄 License](#-license)

---

## 📍 Overview

USOF is a Reddit-like application express API. It is a RESTful API that allows users to create posts, comments, and likes. The API is built with Node.js, Express, and Prisma. It uses a MySQL database to store user and post data. The API is secured with JWT authentication and authorization. The API is documented with Swagger and OpenAPI. The API is deployed to Azure and uses AWS S3 to store images. The API is linted with ESLint and formatted with Prettier.

---

## 🚀 Getting Started

### ⚙️ Installation

1. Clone the USOF repository:

```sh
git clone https://github.com/mkloz/usof-backend.git
```

2. Change to the project directory:

```sh
cd usof-backend
```

3. Install the dependencies:

```sh
npm install
```

4. Create a `.env` file in the root directory and add environment variables like in `.env.example` file.

### 🗄️ Database Setup

1. Create a `.env` file in the root directory and add your database connection string:

```env
DATABASE_URL="mysql://user:password@localhost:3306/usof"
```

2. Run the following command to apply database migrations:

```sh
npm run migrate
```

3. Seed the database with initial data:

```sh
npm run seed
```

4. Verify the database connection and data:

```sh
npm run prisma:studio
```

### 🤖 Running USOF

Use the following command to run the USOF application:

```sh
npm run build && nmp run start
```

---

## 📜 Swagger Documentation

To view the Swagger documentation for the USOF API, follow these steps:

1. Ensure the USOF application is running.
2. Open your web browser and navigate to `http://localhost:3000/api/docs`.

This will open the Swagger UI, where you can explore and test the API endpoints interactively.

Alternatively, you can view the OpenAPI YAML documentation by navigating to `/docs` folder.

--

## 🗄️ Database Schema

The database schema is defined using Prisma. Below is a visual representation of the schema:


Database Schema

---

## 🤝 Contributing

Contributions are welcome! Here are several ways you can contribute:

- **[Submit Pull Requests](https://github.com/mkloz/usof-backend/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs.
- **[Join the Discussions](https://github.com/mkloz/usof-backend/discussions)**: Share your insights, provide feedback, or ask questions.
- **[Report Issues](https://github.com/mkloz/usof-backend/issues)**: Submit bugs found or log feature requests for Usof-backend.

Contributing Guidelines

1. **Fork the Repository**: Start by forking the project repository to your GitHub account.
2. **Clone Locally**: Clone the forked repository to your local machine using a Git client.
```sh
git clone https://github.com/mkloz/usof-backend
```
3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name.
```sh
git checkout -b new-feature-x
```
4. **Make Your Changes**: Develop and test your changes locally.
5. **Commit Your Changes**: Commit with a clear message describing your updates.
```sh
git commit -m 'Implemented new feature x.'
```
6. **Push to GitHub**: Push the changes to your forked repository.
```sh
git push origin new-feature-x
```
7. **Submit a Pull Request**: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.

---

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/mkloz/usof-backend/blob/main/LICENSE) file for details.