Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/louis-lau/duckyapi
Domain admin API on top of the WildDuck API. Back-end for DuckyPanel.
https://github.com/louis-lau/duckyapi
duckypanel email openapi3 rest-api typescript wildduck
Last synced: about 2 months ago
JSON representation
Domain admin API on top of the WildDuck API. Back-end for DuckyPanel.
- Host: GitHub
- URL: https://github.com/louis-lau/duckyapi
- Owner: louis-lau
- License: agpl-3.0
- Created: 2019-07-20T16:55:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-14T22:27:42.000Z (almost 3 years ago)
- Last Synced: 2023-03-08T11:08:14.156Z (almost 2 years ago)
- Topics: duckypanel, email, openapi3, rest-api, typescript, wildduck
- Language: TypeScript
- Homepage: https://louis-lau.github.io/DuckyAPI
- Size: 2.93 MB
- Stars: 14
- Watchers: 3
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
__NOTE:__ This project is still a work in progress. You can already check it out if you're curious. The API may change in the future.
# DuckyAPI
API that interacts with the [WildDuck](https://github.com/nodemailer/wildduck) API. Mostly built as a backend to [DuckyPanel](https://github.com/louis-lau/DuckyPanel).
![We need to go deeper](docs/images/deeper.jpg)
## Why?
In WildDuck a user is a single Email Account, using the api as an end-user you can add address aliases to that inbox. You can not add extra email accounts or manage domain level functionality like DKIM. The aim of DuckyAPI is to offer an end-user API that allows complete management of domains and email accounts within those domains.## How?
DuckyAPI stores its users in MongoDB, this can be the same instance that you're already using for WildDuck. Each user owns a list of domains, granting permission to manage dkim or add/edit email accounts and forwarders under that domain. Each user can be assigned a package, containing quotas and limits for the user. Currently nothing happens when quota is exceeded, this may change in the future.Like WildDuck, this application does not depend on memory for anything. Users etc are stored in mongodb, queue management is done in redis. This application is stateless.
## Features
See [DuckyPanel features](https://github.com/louis-lau/DuckyPanel/blob/master/README.md#current-features).## Dependencies
* Node.js
* MongoDB
* Redis
* WildDuck## Installation
```bash
$ git clone https://github.com/louis-lau/DuckyAPI.git
$ cd DuckyAPI
$ npm install
```## Configuration
Copy `config/example.env` to `config/production.env` or `config/development.env` depending on your environment. You must change the configuration for the application to start. If you've misconfigured something the application should tell you on start.## Usage
```bash
$ npm run clean
$ npm run build
$ npm start# Create your first admin user, admin users are
# only meant for adding and updating users/packages
$ node dist/cli create-admin
# Create an api key for your admin user
$ node dist/cli create-apikey# Add a normal user using the api, be sure to replace
# the access token with the one you just got from create-apikey
curl -X POST "http://localhost:3000/users" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN-HERE" \
-H "Content-Type: application/json" \
-d '{"username":"johndoe", "password":"supersecret"}'# Now use the normal user to log in to DuckyPanel,
# or request an access token from the /authentication endpoint
```
👆 Instead of using curl you can also execute this request from [localhost:3000/swagger](http://localhost:3000/swagger)## API documentation
API documentation with code examples is available on [louis-lau.github.io/DuckyAPI](https://louis-lau.github.io/DuckyAPI).You can also visit [localhost:3000/swagger](http://localhost:3000/swagger) to try the api out live in your browser. Much nice than using curl!
## Integrated DuckyPanel
DuckyApi can serve DuckyPanel on its integrated server. Just open your configuration and set `SERVE_DUCKYPANEL` to `true`. Then set a custom `BASE_URL` for the api, for example `/api`.Duckypanel will now be live at [localhost:3000](http://localhost:3000), and DuckyApi at [localhost:3000/api](http://localhost:3000/api).
## Task queue
Any created background tasks and their progress can be viewed on [localhost:3000/queues](http://localhost:3000/queues) with basicauth if you've enabled this in the configuration. Removing a domain or suspending a user will trigger a background task to execute mass changes.