#Deploying to Production

9 messages · Page 1 of 1 (latest)

vital sundial
#

So far all of my functions and data has been in my development environment, how can I deploy everything including my data? Also, is there a benefit to having the data in production?

topaz ploverBOT
#

Hi @vital sundial. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To deploy your Convex application to production, you'll need to follow a few steps. Let me explain how to deploy your functions and data separately.

Deploying Your Functions to Production

You can deploy your Convex functions to production using the npx convex deploy command:

npx convex deploy

This command will:

  1. Typecheck your functions
  2. Regenerate code in the convex/_generated directory
  3. Bundle your functions and dependencies
  4. Push your functions, indexes, and schema to production

Deploying Your App to Production explains that every project has one shared production deployment and one development deployment per team member.

Transferring Data to Production

It's important to understand that development and production deployments are completely separate - this is by design to allow you to iterate in development without affecting production data. When you run npx convex deploy, it only deploys your code, not your data.

To transfer your data from development to production, you can use the export/import commands:

  1. Export your data from development:
npx convex export
  1. Import that data to production:
npx convex import --prod

As mentioned by a Convex support staff member in a Discord thread, this allows for a one-time data transfer from the Discord support thread.

Benefits of Having Data in Production

Having your data in a production deployment offers several benefits:

  1. Separation of concerns: You can develop and test new features in your development environment without risking production data.

  2. Stability: Your production environment remains stable while you experiment in development.

#
  1. Team workflow: As explained in the typical team development workflow, this separation allows team members to make backend changes and test them with individual dev deployments before deploying to production.

  2. Preview deployments: With the Pro plan, you can use preview deployments to test changes before they're deployed to production.

Hosting Your Full-Stack App

For a complete deployment solution, you might want to set up automatic deployment with a hosting provider like Vercel or Netlify. These providers can automatically deploy both your frontend and backend whenever you push code to your repository. Check out the Hosting and Deployment documentation for detailed guides.

Remember that when moving to production permanently, you'll also need to transfer any environment variables using npx convex env list/set commands.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@vital sundial Kapa.ai is still learning and improving, please let me know how I did by reacting below.

vital sundial
#

@topaz plover does the production environment have better resources?

topaz ploverBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Based on the knowledge sources, there isn't a significant difference in resources or performance capabilities between Convex development and production environments. The main differences are related to workflow, security, and functionality rather than resource allocation.

According to a Convex support staff member in a Discord thread:

"There aren't any fundamental limitations to dev deployments compared to prod ones, so if you really want to you can use a dev one for a prototype." Is there limitations on the dev cloud environment

The primary differences between development and production environments include:

  1. Error handling and logging: In production, logs are not sent to clients for security reasons, while in development they are visible to help with debugging.

  2. Deployment workflow: Production deployments require explicit confirmation to prevent accidental bugs, while development has the convenient "deploy on save" feature.

  3. Features: Some features like custom domains are only available in production environments.

  4. Security: Production environments have different error reporting behaviors to protect sensitive information.

For scaling and performance considerations, Convex is designed to scale based on your needs regardless of environment. As mentioned by a support staff member in another thread:

"Convex is in general as fast as it needs to be, where we're constantly scaling it to keep up with our busiest customers." Performance testing and credentials from FS

The main benefit of using production is not better resources, but rather the workflow separation that allows for safer development practices and team collaboration.

#

If you're concerned about performance for a production application, Convex offers observability tools and integrations with platforms like Axiom, DataDog, and Sentry to monitor and optimize your application's performance in production.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: