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

https://github.com/asmitranjansinha/localloud-api

LocalLoud API is a NestJS-powered backend providing community-driven discussions, voting systems, and authentication for the LocalLoud mobile app.
https://github.com/asmitranjansinha/localloud-api

api community discussions jwt-authentication localloud mysql nest-js restful-api typescript voting-system

Last synced: 6 months ago
JSON representation

LocalLoud API is a NestJS-powered backend providing community-driven discussions, voting systems, and authentication for the LocalLoud mobile app.

Awesome Lists containing this project

README

          

# ๐ŸŒ LocalLoud API

LocalLoud API is the backend service for the **LocalLoud** mobile application, built with **NestJS**. It provides the necessary APIs for community-driven discussions, voting systems, and user authentication. This project is designed to work seamlessly with the [LocalLoud Flutter frontend](https://github.com/asmitranjansinha/localloud).

---

## โœจ Features

- **๐Ÿ—ฃ Community-Based Discussions** - APIs to create, read, update, and delete community posts.
- **๐Ÿ—ณ Voting System** - APIs to create and participate in polls.
- **๐Ÿ”‘ User Authentication** - Secure user authentication and authorization using JWT.
- **๐Ÿ“ก RESTful APIs** - Clean and well-structured RESTful endpoints.
- **๐Ÿงฉ Modular Architecture** - Organized codebase with a modular structure for scalability.

---

## ๐Ÿ›  Tech Stack

- **๐Ÿš€ Framework**: NestJS
- **๐Ÿ“ฆ Package Manager**: Yarn
- **๐Ÿ’พ Database**: MySQL & SQLite3
- **๐Ÿ” Authentication**: JWT (JSON Web Tokens)
- **โš™ ORM**: TypeORM

---

## ๐Ÿ“‚ Project Structure

```
๐Ÿ“ฆ localloud-api
โ”ฃ ๐Ÿ“‚ src
โ”ƒ โ”ฃ ๐Ÿ“‚ modules
โ”ƒ โ”ƒ โ”— ๐Ÿ“‚ example
โ”ƒ โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“„ example.controller.ts
โ”ƒ โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“„ example.service.ts
โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“„ example.module.ts
โ”ƒ โ”ฃ ๐Ÿ“„ app.controller.ts
โ”ƒ โ”ฃ ๐Ÿ“„ app.module.ts
โ”ƒ โ”— ๐Ÿ“„ main.ts
โ”ฃ ๐Ÿ“‚ test
โ”ƒ โ”— ๐Ÿ“„ (test files)
โ”ฃ ๐Ÿ“„ .env
โ”ฃ ๐Ÿ“„ .gitignore
โ”ฃ ๐Ÿ“„ package.json
โ”ฃ ๐Ÿ“„ yarn.lock
โ”— ๐Ÿ“„ README.md
```

---

## ๐Ÿ“ฆ Dependencies

This project uses the following key dependencies:

### ๐Ÿ”ง Core Dependencies

- `@nestjs/core` - Core framework for building scalable server-side applications.
- `@nestjs/common` - Common utilities and decorators for NestJS.
- `@nestjs/platform-express` - Express platform for NestJS.
- `typeorm` - ORM for database interactions.
- `mysql2` & `sqlite3` - MySQL & SQLite3 database support.
- `bcrypt` - Secure password hashing.
- `jsonwebtoken` - JSON Web Token (JWT) for authentication.

### ๐Ÿ›  Development Dependencies

- `@nestjs/cli` - NestJS command-line interface.
- `@nestjs/schematics` - Schematics for scaffolding NestJS projects.
- `typescript` - TypeScript support.
- `jest` - Testing framework.
- `eslint` & `prettier` - Linting and code formatting.

To install dependencies, run:

```bash
yarn install
```

---

## ๐Ÿš€ Installation

1. **Clone the repository:**

```bash
git clone https://github.com/yourusername/localloud-api.git
cd localloud-api
```

2. **Install dependencies:**

```bash
yarn install
```

3. **Set up environment variables:**

Create a `.env` file in the root directory and add the necessary environment variables (e.g., database connection string, JWT secret).

Example `.env` file:

```env
DATABASE_URL=your_database_url
JWT_SECRET=your_jwt_secret
```

4. **Run the application:**

```bash
yarn start
```

5. **Access the API:**

The API will be available at `http://localhost:3000/api`.

---

## ๐Ÿ— Available Scripts

These scripts help in development, testing, and production:

| Command | Description |
|--------------------------|---------------------------------------------|
| `yarn start` | ๐Ÿš€ Starts the application |
| `yarn start:dev` | ๐Ÿ”„ Starts the app in watch mode for development |
| `yarn start:debug` | ๐Ÿž Starts the app in debug mode |
| `yarn start:prod` | โšก Runs the compiled app in production mode |
| `yarn build` | ๐Ÿ— Builds the project |
| `yarn lint` | ๐Ÿงน Lints the code with ESLint |
| `yarn format` | ๐ŸŽจ Formats the code using Prettier |
| `yarn test` | ๐Ÿงช Runs all tests using Jest |
| `yarn test:watch` | ๐Ÿ‘€ Runs Jest in watch mode |
| `yarn test:cov` | ๐Ÿ“Š Generates a test coverage report |
| `yarn test:debug` | ๐Ÿ›  Runs Jest with debugging enabled |
| `yarn test:e2e` | ๐Ÿ”Ž Runs end-to-end tests |

---

## ๐Ÿค Contributing

Contributions are welcome! Follow these steps to contribute:

1. **Fork the repository.**
2. **Create a new branch:**

```bash
git checkout -b feature/YourFeatureName
```

3. **Commit your changes:**

```bash
git commit -m 'โœจ Add feature XYZ'
```

4. **Push to the branch:**

```bash
git push origin feature/YourFeatureName
```

5. **Open a pull request.**

---

## ๐Ÿ“œ License

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

---