Connect a Custom Database in Wix
TL;DR:
- Enable Velo (Dev Mode) in your Wix dashboard to access advanced development tools
- Create database collections to store and organise your site's content
- Connect database fields to dynamic pages and widgets for interactive content
- Link external APIs to pull in live data from third-party services
- Proper database setup improves site performance and helps with SEO
Connecting a custom database in Wix opens up powerful possibilities for your website. You can store user data, create dynamic content, and build interactive features that would be impossible with static pages alone.
Setting Up Velo Developer Mode
Before you can work with databases, you need to enable Velo (Wix's development platform). This gives you access to coding tools and database management features.
Here's how to turn it on:
- Open your Wix dashboard and go to your site
- Click 'Settings' in the left sidebar
- Look for 'Velo by Wix' and toggle it on
- Accept the terms when prompted
Once enabled, you'll see new options in your dashboard including the Database section and code editor.
Creating Your Database Collection
Database collections are where you store your data. Think of them as organised tables with rows and columns.
To create a new collection:
- Go to 'Database' in your dashboard sidebar
- Click 'Create Collection'
- Give your collection a clear name (like 'Products' or 'Blog Posts')
- Set permissions based on who can read and write data
- Add fields for the data you want to store
Each field needs a type – text for names and descriptions, numbers for prices or quantities, images for photos, and dates for timestamps.
Connecting Data to Your Pages
Once you have a collection set up, you can display that data on your site using dynamic pages or by connecting individual elements.
For dynamic pages:
- Add a new page and select 'Dynamic Page'
- Choose which collection to connect it to
- Design your page template – it will automatically generate pages for each item in your collection
For individual elements:
- Select any text box, image, or other element on your page
- Click the database icon that appears
- Choose which field from your collection to display
- The element will now show data from your database
Working with External APIs
APIs let you pull data from external services into your Wix database. This is useful for displaying live information like weather data, social media feeds, or product catalogues.
To connect an external API:
- Go to 'Database' then 'External Collections'
- Click 'Connect External Collection'
- Enter the API endpoint URL
- Configure authentication if required
- Map the API fields to your database structure
The data will now appear alongside your regular collections and can be used in the same way.
Best Practices for Database Performance
Keep these tips in mind when building your database:
- Only store data you actually need – extra fields slow down queries
- Use clear, descriptive field names
- Set appropriate permissions to protect sensitive information
- Test your dynamic pages with different amounts of data
- Consider pagination for large collections to improve loading times
Database connections work best when you plan the structure before you start building. Sketch out what data you need and how it relates to different pages on your site.
FAQs
Can I connect to my existing external database?
Wix doesn't support direct connections to external databases like MySQL or PostgreSQL. You'll need to use APIs or import your data into Wix collections.
How many database collections can I create?
This depends on your Wix plan. Basic plans have limits on collections and storage, while premium plans offer more capacity.
Do I need coding skills to use databases in Wix?
Basic database setup works through the visual interface, but advanced features like custom queries require some JavaScript knowledge.
Can visitors to my site add data to my database?
Yes, you can create forms and user input areas that write to your database. Just make sure to set the right permissions first.
Jargon Buster
Collection – A database table that stores related information, like all your products or blog posts
Field – An individual piece of data within a collection, such as a product name or price
Dynamic Page – A page template that automatically creates individual pages for each item in a database collection
API – Application Programming Interface, a way for different software systems to share data
Velo – Wix's development platform that adds coding capabilities to your site
Wrap-up
Database connections transform static Wix sites into dynamic, data-driven experiences. Start with Velo enabled and a simple collection to get familiar with the tools. As you get more comfortable, you can add external APIs and build more complex database relationships.
The key is starting small and building up. Create one collection, connect it to a page, and see how it works before expanding to more complex setups.
Ready to level up your Wix development skills? Join Pixelhaze Academy for in-depth tutorials and expert guidance.