Deploying Flatnotes
Introduction
Flatnotes is a lightweight, self-hosted note-taking application designed for simplicity and speed. Built with a minimalist approach, Flatnotes provides a clean, distraction-free interface for managing your notes in markdown format. It’s perfect for developers, writers, and anyone who values privacy and wants full control over their note-taking data.
Key features of Flatnotes include:
- Markdown Support: Write notes in markdown with live preview
- Fast and Lightweight: Built for speed with minimal resource requirements
- Self-Hosted: Full control over your data and privacy
- Simple Interface: Clean, intuitive UI focused on writing
- File-Based Storage: Notes stored as simple markdown files on disk
Deploying Flatnotes on Klutch.sh provides you with a reliable, scalable platform for your personal note-taking system, with automated deployments from GitHub and persistent storage for your notes.
Prerequisites
Before you begin, ensure you have:
- A Klutch.sh account (sign up here)
- A GitHub account with a repository for your Flatnotes deployment
- Basic understanding of Docker and containerization
- Familiarity with markdown syntax (helpful but not required)
Getting Started with Flatnotes
Flatnotes is designed to be deployed as a Docker container, making it ideal for deployment on Klutch.sh. The application stores notes as markdown files in a persistent storage directory, ensuring your data is preserved across deployments.
Understanding Flatnotes Architecture
- Port: Flatnotes runs on port
8080by default - Storage: Requires persistent storage mounted at
/datafor note storage - Authentication: Supports optional password protection via environment variables
- File Format: All notes are stored as plain markdown files
Deploying Flatnotes with a Dockerfile
Klutch.sh automatically detects and uses a Dockerfile when present in your repository’s root directory. Follow these steps to deploy Flatnotes:
Step 1: Create Your Repository
-
Create a new GitHub repository for your Flatnotes deployment
-
Clone the repository to your local machine:
Terminal window git clone https://github.com/yourusername/flatnotes-deploy.gitcd flatnotes-deploy
Step 2: Create the Dockerfile
Create a Dockerfile in the root of your repository with the following content:
# Use the official Flatnotes imageFROM dullage/flatnotes:latest
# Expose the port Flatnotes runs onEXPOSE 8080
# The /data directory will be used for persistent storageVOLUME ["/data"]
# Start FlatnotesCMD ["python", "-m", "flatnotes"]This Dockerfile uses the official Flatnotes image and exposes port 8080. The /data directory is designated as a volume for persistent note storage.
Step 3: Optional Configuration Files
You can create a .env.example file to document available environment variables:
# Optional: Set a password for authentication# FLATNOTES_AUTH_TYPE=password# FLATNOTES_PASSWORD=your-secure-password
# Optional: Set the title of your Flatnotes instance# FLATNOTES_TITLE=My Notes
# Optional: Enable search functionality# FLATNOTES_SEARCH_ENABLED=trueNote: Don’t commit actual secrets to your repository. Set these as environment variables in Klutch.sh.
Step 4: Push to GitHub
git add Dockerfile# If you created .env.example, add it too# git add .env.examplegit commit -m "Add Flatnotes Dockerfile and configuration"git push origin mainStep 5: Deploy on Klutch.sh
- Log in to Klutch.sh Dashboard
- Create a new project and give it a descriptive name (e.g., “Flatnotes”)
- Create a new app within your project:
- Repository: Select your Flatnotes GitHub repository
- Branch: Choose your deployment branch (usually
main) - Traffic Type: Select HTTP (Flatnotes is a web application)
- Internal Port: Set to
8080(the port Flatnotes listens on) - Region: Choose your preferred deployment region
- Compute Resources: Select based on your expected usage (start with the smallest tier)
- Instances: Start with 1 instance
Step 6: Configure Persistent Storage
- In your app settings, navigate to the Volumes section
- Click Add Volume
- Configure the volume:
- Mount Path:
/data - Size: Start with 1GB (adjust based on your needs)
- Mount Path:
- Click Create to attach the volume
Flatnotes requires persistent storage to save your notes between deployments:
This ensures your notes are preserved across deployments and restarts.
Step 7: Set Environment Variables (Optional)
- Navigate to the Environment Variables section in your app settings
- Add the following variables as needed:
FLATNOTES_AUTH_TYPE: Set topasswordto enable password protectionFLATNOTES_PASSWORD: Your secure password (mark as secret)FLATNOTES_TITLE: Custom title for your notes appFLATNOTES_SEARCH_ENABLED: Set totrueto enable search
If you want to enable authentication or customize your Flatnotes instance:
Security Note: Always mark sensitive variables like passwords as secrets in the Klutch.sh dashboard.
Step 8: Deploy
- Detect your Dockerfile automatically
- Build the Docker image
- Deploy your container with the specified configuration
- Make your app available at a URL like
example-app.klutch.sh
Click Create to deploy your Flatnotes instance. Klutch.sh will:
Accessing Your Flatnotes Instance
Once deployed, your Flatnotes instance will be available at the URL provided by Klutch.sh (e.g., your-flatnotes-app.klutch.sh). If you enabled password authentication, you’ll be prompted to log in when you first access the app.
Sample Dockerfile Variations
Minimal Dockerfile
For the simplest deployment:
FROM dullage/flatnotes:latestEXPOSE 8080Klutch.sh will handle the rest automatically.
Advanced Dockerfile with Health Check
For production deployments with health monitoring:
FROM dullage/flatnotes:latest
# Install curl for health checks (if not already present)RUN apk add --no-cache curl || apt-get update && apt-get install -y curl
# Expose the application portEXPOSE 8080
# Add a health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/ || exit 1
# Volume for persistent dataVOLUME ["/data"]
# Start the applicationCMD ["python", "-m", "flatnotes"]Environment Variables Reference
Flatnotes supports several environment variables for customization:
| Variable | Description | Default | Example |
|---|---|---|---|
FLATNOTES_AUTH_TYPE | Authentication method | none | password |
FLATNOTES_PASSWORD | Password for authentication | - | your-secure-password |
FLATNOTES_TITLE | Application title | Flatnotes | My Personal Notes |
FLATNOTES_SEARCH_ENABLED | Enable search functionality | false | true |
FLATNOTES_TOTP_KEY | TOTP key for 2FA | - | - |
Set these variables in the Klutch.sh dashboard under your app’s environment variables section.
Persistent Storage Best Practices
Storage Requirements
- Minimum: 1GB for basic note-taking
- Recommended: 5GB for active users with many notes
- Heavy Usage: 10GB+ for large note collections with attachments
Backup Considerations
Your notes are stored in the /data directory. Consider:
- Regular backups of your persistent volume
- Version control for critical notes
- Export functionality for disaster recovery
Storage Path Structure
Flatnotes organizes notes in the following structure within /data:
/data/ └── notes/ ├── note1.md ├── note2.md └── subfolder/ └── note3.mdCustomizing Your Deployment
Custom Domain
To use a custom domain with your Flatnotes instance:
- Navigate to your app settings in Klutch.sh
- Go to the Domains section
- Add your custom domain
- Configure your DNS settings as instructed
- Klutch.sh will automatically provision SSL certificates
For more details, see the Custom Domains Guide.
Scaling Considerations
Flatnotes is designed for single-user or small team usage. For optimal performance:
- Start with minimal compute resources
- Monitor resource usage in the Klutch.sh dashboard
- Scale up if you notice performance issues
- One instance is typically sufficient for personal use
Troubleshooting Common Issues
Issue: Notes Not Persisting
Solution: Ensure the persistent volume is correctly mounted to /data:
- Check volume configuration in Klutch.sh dashboard
- Verify the mount path is exactly
/data - Redeploy the app after adding the volume
Issue: Can’t Access the Application
Solution: Verify your network settings:
- Ensure traffic type is set to HTTP
- Confirm internal port is set to
8080 - Check that the deployment completed successfully
- Review application logs for errors
Issue: Authentication Not Working
Solution: Check your environment variables:
- Verify
FLATNOTES_AUTH_TYPEis set topassword - Ensure
FLATNOTES_PASSWORDis configured - Confirm variables are marked as secrets if sensitive
- Restart the application after changing variables
Monitoring and Maintenance
Application Logs
Monitor your Flatnotes instance through the Klutch.sh dashboard:
- Navigate to your app
- Click on Logs to view real-time application logs
- Look for errors or warnings
- Use logs for debugging and troubleshooting
Health Monitoring
To ensure your Flatnotes instance is running smoothly:
- Monitor CPU and memory usage in the dashboard
- Set up uptime monitoring for the application URL
- Check logs regularly for any issues
- Keep the Flatnotes Docker image updated
Updates and Maintenance
To update Flatnotes to the latest version:
- Update the image tag in your Dockerfile (or keep
latestfor automatic updates) - Push changes to GitHub
- Klutch.sh will automatically rebuild and redeploy your app
Security Best Practices
Authentication
For production deployments:
- Always enable password authentication using
FLATNOTES_AUTH_TYPE=password - Use a strong, unique password stored as a secret in Klutch.sh
- Consider enabling TOTP-based 2FA for additional security
Network Security
- Keep your Flatnotes instance private if not needed publicly
- Use custom domains with SSL/TLS (automatically provided by Klutch.sh)
- Review access logs regularly
Data Security
- Regular backups of your persistent volume
- Keep the Flatnotes image updated for security patches
- Never commit secrets or passwords to your repository
- Use environment variables for all sensitive configuration
Advanced Configuration
Using Nixpacks for Customization
While this guide focuses on Dockerfile deployment, if you need to customize build or start commands through Nixpacks, you can set environment variables:
BUILD_COMMAND: Custom build command (not typically needed for Flatnotes)START_COMMAND: Custom start command if you need to override the default
However, the Dockerfile approach is recommended for Flatnotes as it provides the most reliable deployment.
Resources
- Flatnotes GitHub Repository
- Flatnotes Documentation
- Klutch.sh Quick Start Guide
- Klutch.sh Volumes Guide
- Klutch.sh Deployments Guide
- Klutch.sh Custom Domains Guide
Conclusion
Deploying Flatnotes on Klutch.sh gives you a fast, private, and reliable note-taking solution with the benefits of automated deployments, persistent storage, and easy scaling. The combination of Flatnotes’ simplicity and Klutch.sh’s robust infrastructure makes it an ideal setup for anyone looking to self-host their notes securely.
With this guide, you now have everything you need to:
- Deploy Flatnotes using Docker on Klutch.sh
- Configure persistent storage for your notes
- Secure your instance with authentication
- Customize and maintain your deployment
Start taking notes with confidence, knowing your data is under your control and deployed on reliable infrastructure.