Flint DartFlint Dart

πŸš€ Deploying Flint Dart Applications

This guide walks you through deploying your Flint Dart app to production environments with recommended best practices.

1. Prepare Your App for Production

  • Ensure all development-only features (e.g., debug logs, hot reload) are disabled.
  • Set your environment variables for production (see next section).
  • Use secure authentication and HTTPS in production.

2. Set Environment Variables

Flint Dart supports environment variables to configure database credentials, secret keys, and other sensitive data.

export FLINT_ENV=production
export DB_HOST=your_database_host
export DB_USER=your_database_user
export DB_PASS=your_database_password
export JWT_SECRET=your_jwt_secret

You can load these using the dotenv package or your hosting platform’s environment settings.

3. Build and Run for Production

To optimize your app, build the release version before deploying:

dart compile exe bin/server.dart -o build/server
./build/server

Alternatively, run directly with production environment set:

FLINT_ENV=production dart run bin/server.dart

4. Deploying to Platforms

Common deployment targets for Flint Dart apps:

  • VPS / Dedicated Server: Deploy the compiled executable, configure systemd or supervisord for process management.
  • Docker: Create a Dockerfile to containerize your app for easy deployment and scaling.
  • Cloud Providers: Use services like AWS EC2, Google Cloud Compute Engine, or DigitalOcean Droplets.
  • Platform-as-a-Service: Flint Dart apps can be deployed on Heroku, Render, or Fly.io with appropriate build steps.

5. Example: Dockerfile for Flint Dart

FROM dart:stable AS build

WORKDIR /app

COPY pubspec.* ./
RUN dart pub get

COPY . .

RUN dart compile exe bin/server.dart -o build/server

FROM scratch

COPY --from=build /runtime/ /
COPY --from=build /app/build/server /app/server

EXPOSE 3000

CMD ["/app/server"]

Build your Docker image with:

docker build -t flint-dart-app .

Tips for Production Deployment

  • Use reverse proxies like Nginx to manage HTTPS and load balancing.
  • Configure proper logging and monitoring for your app.
  • Secure your environment variables and secrets.
  • Regularly update dependencies and Dart SDK to latest stable versions.