https://github.com/mahardikakdenie/cloud-api-imgbb
https://github.com/mahardikakdenie/cloud-api-imgbb
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mahardikakdenie/cloud-api-imgbb
- Owner: mahardikakdenie
- Created: 2024-10-12T15:27:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-26T17:56:33.000Z (over 1 year ago)
- Last Synced: 2025-01-28T10:37:08.730Z (over 1 year ago)
- Language: TypeScript
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# express - typescript - imgbb cloud
A template for initializing a TypeScript project with Express version 4.21.0.
**Created by Mahardika Kessuma Denie, this project is ideal for developers seeking a fast, scalable, and organized solution to incorporate imgbb cloud storage into their backend processes.**
## Description
This repository serves as a starting point for building Node.js applications using TypeScript and Express (v4.21.0), specifically tailored for integrating with the imgbb image hosting API. It provides a clean and efficient structure to kickstart development, allowing you to easily implement image uploading functionality to imgbb cloud storage.
Whether you're developing a web application that requires image handling or simply looking to streamline your backend processes, this template offers a flexible and scalable solution. Enjoy the power of TypeScript with the simplicity of Express, combined with seamless integration to imgbb for fast and secure image hosting.
## Features
- TypeScript: Ensures type safety and cleaner code.
- Express 4.21.0: Lightweight, fast, and flexible web framework.
- imgbb Cloud Integration: Preconfigured for easy image uploads to imgbb.
- Pluggable database layer: Supports both MongoDB (default) and PostgreSQL.
- Clear Project Structure: Simplifies code organization and scaling.
- Environment Configuration: Setup for both development and production modes.
## Prerequisites
Before you begin, ensure you have the following installed:
- [Node.js](https://nodejs.org/) (version 14 or newer)
- [npm](https://www.npmjs.com/) (usually installed with Node.js)
- imgbb API Key: You need to obtain an API key from [imgbb](https://api.imgbb.com) to enable image uploads.
## Installation
1. Clone this repository:
```bash
git clone https://github.com/mahardikakdenie/cloud-api-imgbb.git
```
2. Go into the project directory:
```bash
cd cloud-api-imgbb
```
3. Install dependencies:
```bash
npm install
```
## Environment Setup
Add the required environment variables in your `.env` file:
```bash
PORT=
IMGBB_API_KEY=
# Choose database driver: mongodb (default) or postgres
DB_CLIENT=mongodb
# MongoDB connection URI (required when DB_CLIENT=mongodb)
DB_URI=
# PostgreSQL connection URI (required when DB_CLIENT=postgres)
PG_URI=
```
## Database options
### MongoDB (default)
- Set `DB_CLIENT=mongodb`
- Set `DB_URI`
### PostgreSQL
- Set `DB_CLIENT=postgres`
- Set `PG_URI`
- Ensure PostgreSQL user has permission to create tables. On startup, the service auto-creates the `media` table if it does not exist.
## Running the Project
```bash
npm run dev
```
## Project Structure
```bash
cloud-api-imgbb
│
├── src/
│ ├── controller/
│ │ └── media_controller.ts
│ ├── database.ts
│ ├── interface/
│ ├── libs/
│ ├── middleware/
│ ├── model/
│ ├── repository/
│ ├── routes/
│ ├── service/
│ └── index.ts
├── README.md
├── package.json
└── tsconfig.json
```
## Contributing
_If you would like to contribute to this project, please fork the repository and submit a pull request._