When you are an independent contractor or freelancer, you need to keep track of the hours you work per day and the tasks you do. You can use a Notion database to keep track of this information, but you need to generate an invoice at the end of the month to send to your clients. You can use tools like canva or google docs to create a beautiful invoice, but you need to copy the information from the Notion database to the invoice manually.
This project is a simple web application that connects to a Notion database and displays the information in a beautiful invoice format. You can generate a PDF of the invoice and send it to your clients.
- Node.js
- Notion Account
- A Notion database with the following columns:
- Date (Date)
- Task (Text)
- Hours (Number)
First, clone the repository and navigate to the project directory.
git clone lukasalvarezdev/notion-database-to-invoice-pdf
cd notion-database-to-invoice-pdf
Install the dependencies:
npm install
Copy the .env.example
file to .env
and replace with real values.
cp .env.example .env
Next, you need to get your Notion API key and database ID.
- Go to Notion Integrations.
- Click on
New Integration
. - Name your integration and click
Submit
. - Copy the
Internal Integration Secret
and paste it in the.env
file asNOTION_API_KEY
. - Go to the Notion page you want to use as a database, to get the database ID, check the URL.
It should look like
https://www.notion.so/{workspace}/{database_id}?v={version}
. Copy thedatabase_id
and paste it in the.env
file asNOTION_DATABASE_ID
.
Run the development server:
npm run dev
Open up http://localhost:3000 in your browser.
Just click on the Generate PDF
button or press Ctrl + P
to print the page and save it as a
PDF.