Backend server for EpubPress.
For clients, see epub-press-clients.
This section is for those who want to simply run epub-press locally. If you want to develop epub-press, see the next section Development Setup.
You may use docker-compose to stand up both the epub-press server and the backing PostgreSQL database.
- Install Docker
docker-compose up server
EpubPress will be running at http://localhost:3000
.
Follow these instructions to run epub-press without Docker or develop epub-press.
Clone this repository and install npm dependencies. Use the node version indicated
in .nvmrc
. See the nvm project for details on Node
Version Manager.
$ git clone https://github.com/haroldtreen/epub-press
$ cd epub-press
$ # optional nvm use
$ npm install
You may develop this project backed by a PostgreSQL or SQLite database (the default for development and test environments).
- Install Docker
- With Sqlite
echo DB_DIALECT=sqlite > .env.local
- With postgres
docker-compose up postgres
- With Sqlite
npm start
Run database migrations one time:
npm run db:migrate
EpubPress will be running at http://localhost:3000
and reload upon file changes.
To build a version of EpubPress that talks to a local server, see epub-press-chrome.
npm run test:integration # Test API + full article extraction
npm run test:models # Test models
npm run test:unit # Test regular JS
npm run test # Test all of the above
Changes should be accompanied by tests. All tests located in /tests
.
API Documentation is here.
$ # create a book
$ curl http://localhost:3000/api/v1/books \
-H "Content-Type: application/json" \
-X POST \
-d '{
"title": "A title",
"description": "A description",
"author": "An author",
"genre": "ebooks",
"coverPath": "",
"urls": [
"https://epub.press"
]
}'
{"id":"RXyGKmTq7"}
$ # download the book as epub file
$ curl -o book.epub http://localhost:3000/api/v1/books/RXyGKmTq7/download
$ # or download as mobi file
$ curl -o book.mobi "http://localhost:3000/api/v1/books/RXyGKmTq7/download?filetype=mobi"
$ ls
book.epub
Name | Default | Description |
---|---|---|
MAIL_SERVER_HOST |
Hostname of SMTP mail server | |
MAIL_SERVER_PORT |
Port of SMTP mail server | |
MAIL_SERVER_TLS |
Leave blank by default. If using SSL/TLS for the SMTP connection, set the value to true . |
|
MAIL_SERVER_USERNAME |
Username for SMTP authentication | |
MAIL_SERVER_PASSWORD |
Password for SMTP authentication | |
MAIL_SENDER_ADDRESS |
[email protected] | Sender email address |
MAX_NUM_SECTIONS |
50 | Sets the maximum number of articles in one book. |
Build argument (in Dockerfile):
converter
- leave as "calibre" to download and use Calibre for MOBI conversion (the setup for which assumes by default that the host is Debian-like). If not, or if there are errors, change the value of this variable to "kindlegen" to use the binaries in /bin/
.