Invoice Ninja is open-source invoicing and accounting software that you can host yourself. You can manage customers and products, create quotes, invoices, and credit notes, send them as PDFs by email, and track payments, expenses, and work hours. Recurring invoices and payment reminders run automatically, and your customers can view their invoices in a dedicated customer portal. Invoice Ninja is written in PHP using the Laravel framework and stores everything in a MySQL or MariaDB database. This guide shows you two ways to install it: the easy way, as a One-Click App that makes Invoice Ninja available over HTTPS in just a few clicks, and a manual installation with Docker Compose. After that, you'll set up your company, configure email delivery, and create your first invoice.
A server of your own is worthwhile if you don't want to store invoice data with a cloud provider. Invoice Ninja is a good fit for a VPS if:
- You want to manage customer, invoice, and payment data yourself on a server you control.
- You're self-employed, a freelancer, or a small business and want to create quotes, invoices, and credit notes with one tool, without paying per user or invoice.
- You regularly bill for the same services and want recurring invoices and payment reminders sent automatically.
- You want your customers to view and pay their invoices online, for example through Stripe or PayPal in the customer portal.
- You want to track time and expenses by project and add them directly to invoices.
Invoice Ninja is less suitable if you need full accounting features such as a chart of accounts, VAT returns, or integration with your tax advisor. Invoice Ninja creates invoices and tracks payments, but it doesn't replace accounting software. If you're looking for a simpler tool just for invoices, take a look at InvoiceShelf in the app catalog.
Invoice Ninja generates a PDF for every invoice. The PDF_GENERATOR value determines where this happens:
snappdf (One-Click App default) | hosted_ninja | |
|---|---|---|
| Where is the PDF generated? | On your VPS using Chromium in the container | By the Invoice Ninja PDF service (pdf.invoicing.co) |
| What leaves your server? | Nothing | The contents of each invoice as HTML |
| Resource usage | Chromium needs some extra RAM briefly while generating the PDF | Minimal load on your VPS |
With snappdf, your invoice data stays on your server. The One-Click App image already includes Chromium, and a PDF is ready in a few seconds. With hosted_ninja, Invoice Ninja sends the complete invoice content, including the customer's name, address, and amounts, to an external service. This saves some computing resources on your VPS, but is only worthwhile if you're comfortable with that.
The quickest way to get started with Invoice Ninja is through your VPS's One-Click Apps. The app starts together with a MariaDB database and Redis, is available directly over HTTPS when you use a domain, and creates your account during installation. App keys and passwords are generated automatically.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set up One-Click Apps for instructions.
- At least 2 GB of RAM and 10 GB of free storage. The Invoice Ninja image is quite large at around 3.4 GB, and the database, logos, and uploaded receipts need additional space.
- Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
- Search the app catalog for Invoice Ninja and click Install app.
- Use a custom subdomain or zap.cloud is already selected. Leave it enabled and enter a name, such as
invoices. The address becomes yourAPP_URL: links in emails and the customer portal will point to it. - Open App configuration and enter your email address in
IN_USER_EMAIL. You'll use it to sign in later. If you leave this field empty, your account will be namedadmin@example.com. PDF_GENERATORis already set tosnappdf, so PDFs will be generated on your server (see above).PHP_CLI_SERVER_WORKERS(default4) determines how many requests Invoice Ninja handles at the same time; leave this value as it is. You can fill in theMAIL_*fields now or add them later. LeaveAWS_*,NORDIGEN_*,SCOUT_DRIVER, andLICENSE_KEYempty.- Click Queue installation.
Installation takes a few minutes. On its first launch, Invoice Ninja creates the database and your account.
A password for your account is generated automatically:
- Click the gear icon on the app card and go to App environment.
- Under Automatically generated values, find
SERVICE_PASSWORD_INVOICENINJAUSER. Click the eye icon to show the value, or the icon next to it to copy it. Your email address is the value ofIN_USER_EMAIL, which appears further up in the same list. The other generated values (SERVICE_PASSWORD_MARIADB,SERVICE_PASSWORD_REDIS, and others) are used internally by the app; you don't need them to sign in. - Open the app using the Access link. On the sign-in page, enter your email address, click Continue, enter your password, and click Login.
- Invoice Ninja welcomes you with the “Welcome to Invoice Ninja” window. Enter your company name under Company Name, choose a language under Language, and choose a currency under Currency, such as euros, then click Save.
After that, change your password in Invoice Ninja under Settings > User Details and, if you kept admin@example.com, change your email address too. The One-Click App doesn't have a setup page for the first visitor: the /setup address redirects to the login page because the account already exists.
Invoice Ninja reads IN_USER_EMAIL and SERVICE_PASSWORD_INVOICENINJAUSER only while no account exists yet. Changes to these values won't have any effect afterward. You can only change your email address and password in Invoice Ninja itself.
By default, MAIL_MAILER is set to log. In this case, Invoice Ninja won't send any emails, including invoices or password reset links. If MAIL_FROM_ADDRESS is also missing, every attempt to send an email fails with “An email must have a "From" or a "Sender" header”. You can find this message in Invoice Ninja under Settings > System Logs. You'll need an email account with a mail provider to send emails:
- Open the app settings (gear icon) and go to the App environment tab.
- Set
MAIL_MAILERtosmtpand enter your provider'sMAIL_HOST,MAIL_PORT,MAIL_USERNAME,MAIL_PASSWORD, andMAIL_ENCRYPTION, for example port587withtls. - Enter the sender address associated with your email account in
MAIL_FROM_ADDRESS, and your company name inMAIL_FROM_NAME. - Click Save so the app restarts with the new values.
On newly ordered VPSs, outgoing connections on ports 25 and 465 are blocked until you verify a phone number in your account. Port 587 is available. For details, see Open Ports and Manage the Firewall.
APP_KEY is generated from the automatically created SERVICE_REALBASE64_INVOICENINJA value. Laravel uses it to encrypt stored secrets, such as your payment provider credentials. Don't change it. Without the correct key, Invoice Ninja won't be able to read this data.
Update Invoice Ninja in the app settings (gear icon) under App update. Click Check for updates and install a new version using Apply update. If the app is reported as up to date, there isn't a newer version in the app catalog yet. When a new version starts, Invoice Ninja automatically updates the database.
Customers, invoices, and settings are stored in the MariaDB database, while logos and uploaded receipts are stored in the app's storage volume. Both are retained during updates. Back up your VPS before an update, for example, using Backups in the dashboard. You can also export a backup of your company data in Invoice Ninja under Settings > Backup | Restore.
The rest of this guide describes a manual installation of Invoice Ninja with Docker Compose on your VPS. This option is useful if, for example, you don't use One-Click Apps on your server or want to run Invoice Ninja behind your own reverse proxy. We'll use the developers' official Debian image, which includes nginx, Chrome for PDF generation, and dedicated processes for the queue and scheduler.
- A Linux VPS running Debian or Ubuntu, with SSH access. See First Access via SSH.
- Docker and Docker Compose (Compose v2), as well as
git. See Install Docker. Check the installation withdocker --versionanddocker compose version. - A domain or subdomain with an A record pointing to your VPS's IP address (for example,
invoices.example.com).
The developers don't specify fixed hardware requirements. The table shows recommended guidelines for a small business running the app, nginx, MySQL, and Redis:
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU core | 2 vCPU cores |
| RAM | 2 GB | 4 GB |
| Storage | 10 GB | 20 GB |
In this guide, Invoice Ninja is only accessible from the server itself; external access is provided exclusively through the reverse proxy. Use ufw to allow only SSH and the ports required by the reverse proxy:
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Ports published by Docker with ports: are accessible externally even if they're blocked by ufw. The official Compose file publishes nginx on port 80 on all addresses. Change this to 127.0.0.1 as described below. For more about the firewall, see Firewall Management on Linux.
Download the developers' files. They include the Compose file, the nginx configuration, and a template for the .env file:
git clone https://github.com/invoiceninja/dockerfiles.git -b debian /opt/invoiceninja
cd /opt/invoiceninja/debian
chmod 600 .env
Generate the app key and two passwords. Make a note of the output; you'll need it shortly:
docker run --rm invoiceninja/invoiceninja-debian php artisan key:generate --show
openssl rand -hex 20
openssl rand -hex 20
Open the .env file with nano .env and change these lines. Leave the other values as they are:
APP_URL=https://invoices.example.com
APP_KEY=APP_KEY_FROM_THE_FIRST_COMMAND
APP_DEBUG=false
PDF_GENERATOR=snappdf
DB_PASSWORD=PASSWORD_1
MYSQL_PASSWORD=PASSWORD_1
DB_ROOT_PASSWORD=PASSWORD_2
MYSQL_ROOT_PASSWORD=PASSWORD_2
IN_USER_EMAIL=name@example.com
IN_PASSWORD=YOUR_LOGIN_PASSWORD
Here's what the important lines mean:
APP_URL: The public address, includinghttps://. Invoice Ninja uses it to create links in emails, PDFs, and the customer portal.APP_KEY: Encrypts stored secrets. Keep it with your backup and don't change it later.DB_*andMYSQL_*: The same password for the app and database containers. The template includes known default passwords, so always replace them.IN_USER_EMAILandIN_PASSWORD: Create your account on the first launch. Setup will fail if these values are missing.PDF_GENERATOR=snappdf: PDFs are generated on your server using Chrome in the container.
Next, open docker-compose.yml and change the line under ports: for the nginx service from "80:80" to:
- "127.0.0.1:8012:80"
This makes Invoice Ninja accessible only from the server itself, on port 8012. Start the containers:
docker compose pull
docker compose up -d
docker compose logs -f app
The first launch takes a few minutes while Invoice Ninja creates the database and your account. Exit the log view with Ctrl+C once no new lines appear. Afterward, docker compose ps will show all four containers as running, with the app service marked healthy.
Set up the reverse proxy in the next section first. Then open https://invoices.example.com and sign in using IN_USER_EMAIL and IN_PASSWORD. After that, delete the IN_PASSWORD line from .env; it won't be needed after setup. Finish setting things up as described above under “First Login.”
To access Invoice Ninja externally, place a reverse proxy with a valid certificate in front of it. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). Here's a server block for nginx on the host:
server {
listen 80;
server_name invoices.example.com;
client_max_body_size 50M;
location / {
proxy_pass http://127.0.0.1:8012;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Then get the certificate with certbot --nginx -d invoices.example.com. Certbot adds HTTPS and redirects HTTP to the block. Since TRUSTED_PROXIES='*' is set in .env, Invoice Ninja uses the X-Forwarded-Proto header to determine that the browser is connected over HTTPS. client_max_body_size allows uploads of logos and receipts up to 50 MB. For more security tips, see Linux Security Tips.
Back up the database with mysqldump and the storage volume containing logos and receipts. Docker Compose names the volumes after the folder, which is debian in this case:
cd /opt/invoiceninja/debian
docker compose exec -T mysql sh -c 'exec mysqldump -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE"' > invoiceninja-db-$(date +%F).sql
docker run --rm -v debian_app_storage:/data -v "$PWD":/backup alpine tar czf /backup/invoiceninja-storage-$(date +%F).tar.gz -C /data .
Also back up the .env file containing the APP_KEY. Don't store your backup only on the VPS itself.
Back up the database and volume first, and read the Release Notes. Then pull changes to the Compose file and nginx configuration, along with the new images:
cd /opt/invoiceninja/debian
git pull
docker compose pull
docker compose up -d
If git pull reports a conflict because you changed docker-compose.yml, replace the file with the new version and add the 127.0.0.1:8012:80 port line again. When it starts, Invoice Ninja updates the database to match the new version.
Before sending your first invoice, enter your company details. You'll find all the settings on the left under Settings. If you switch the language to German, the menu items will appear in German.
- Company Details: Name, address, VAT ID, logo, and contact details. These appear in the header of every invoice.
- Localization: Language, currency, time zone, and date format, such as German, euros, and
DD.MM.YYYY. - Tax Settings: Add tax rates, such as 19% and 7%, and choose how many tax rates can be applied to each line item.
- Generated Numbers: Set the format for invoice, quote, and customer numbers, for example, with the year and a sequential number.
- Invoice Design: Choose the PDF template, font, and colors. Under Custom Fields, add your own fields for customers, invoices, or products if needed.
- Click the plus sign next to Clients on the left, enter the company and address, add a contact with an email address, and save.
- Click the plus sign next to Invoices, select the customer, and add line items under Products with a description, unit price, and quantity.
- Save the invoice with Save. Use the menu next to Save to email it or download the PDF.
The customer will receive an email with the PDF attached and a link to the customer portal. There, they can see all their invoices and pay them if you've connected a payment provider such as Stripe or PayPal under Settings > Credit Cards & Banks. Create recurring invoices under Recurring Invoices and set up automatic payment reminders under Settings > Templates & Reminders.
Under Settings > E-Invoicing, choose a format for electronic invoices, such as ZUGFeRD or Peppol. Under Email Settings, use Attach UBL/E-Invoice to attach the e-invoice when sending it. It's best to check with your customer beforehand to confirm which format they accept.
- Legal requirements: You're responsible for ensuring your invoices contain all legally required information and that you store them correctly, for example, in accordance with GoBD. Invoice Ninja provides the fields, but doesn't check that your information is complete. This guide isn't legal or tax advice. If in doubt, consult your tax advisor.
- Not full accounting software: A chart of accounts, VAT returns, and exports for your tax advisor aren't included.
- No built-in mail server: Invoice Ninja can't send emails without SMTP access from a mail provider.
- Branding: The free self-hosted version displays an Invoice Ninja notice in the customer portal and on invoices. Removing it requires a paid white-label license from the developers. You'll find the Purchase White Label button at the top of the app.
- Bank connection: To sync transactions from your bank account through GoCardless (
NORDIGEN_*), you'll need to set it up with your own GoCardless credentials.
You've set up Invoice Ninja on your VPS, configured email delivery, entered your company details, and created your first invoice. Your customers, invoices, and payments are now stored on your own server, and recurring invoices run automatically.
Prefer not to handle Docker yourself? Use the easy One-Click App option described above under “The Easy Way: Invoice Ninja as a One-Click App.”
