The Frontend Toolkit project is a versatile Next.js application that provides essential tools for generating PDF reports and creating customizable email templates.
This leverages Puppeteer to get a snapshot of the web page and convert it into a PDF file. The following reports are available:
Email templates for use in various scenarios, such as alerts, triggers or notifications. The templates are constructed using react-email which provides primitive components for building emails.
Clone the repository:
git clone https://github.com/accuknox/frontend-toolkit.git
Navigate into the project directory:
cd frontend-toolkit
Install dependencies:
pnpm install
Start the development server:
pnpm run dev
Open your browser at http://localhost:8000 to view the application.
This Dockerfile uses a multi-stage build approach to build a Docker image for a Node.js application that uses Puppeteer. The Dockerfile defines several stages, including a base stage, a dependencies installation stage, a build process stage, and an app runner stage.
The base stage uses the official Node.js Alpine-based image and installs Puppeteer dependencies required for running the application.
The dependencies installation stage installs production dependencies using pnpm.
The build process stage builds the application using npm run build.
The app runner stage sets environment variables for production environment, creates a new group and user for running the application, creates a new directory for storing .next files, and copies the standalone and static files from the builder stage to the runner stage. Finally, it sets the user to run the application, exposes the application port, and sets the command to run the application.
Multi-stage builds divide the build process into isolated stages. This separation allows for resuming the build process from a failed stage without affecting the other stages, ensuring that successful stages remain unchanged.
For local testing, we can build the Docker image using the following steps:
3000
for the build process by default, please change the HOST
to http://localhost:3000
in the .env
file.
docker build -t frontend-toolkit .
docker run -p 3000:3000 frontend-toolkit
Happy coding! 🚀