Using SQLite /w Node.js for Rapid Prototyping

What database to choose for my Node.js app?

It seems like in 90% of use cases, a relational database should be a more pragmatic solution as opposed to MongoDB or some other flavor of NoSQL databases. Search for “MongoDB” on Hacker News, and you will find lots of articles similar to these:

How to deploy

When you push your code, including the “migrations” folder, to production server, the database will be deployed automatically right after the Node.js app is started. A good place to deploy your Node.js app with a SQLite backend is Windows Azure App Service, which supports Git-based deployments and has a great infrastructure for hosting Node.js apps that work similarly to Heroku, except that Heroku’s file system doesn’t work well with SQLite databases. In Azure Web Apps your SQLite database file will be safe, surviving app restarts and scaling up/down.

How to manage

Upload the official SQLite tools (sqlite3.exe, sqlite3_analyzier.exe, sqldiff.exe) downloaded from sqlite.org to your Azure Web App host machine and you’re ready to go! Whenever you need to manipulate your production or staging database directly, just open https://<example>.scm.azurewebsites.net in your browser (where “example” is the name of your app in Azure), click Debug Console > CMD in the main menu, getting remote access to the console window on the machine where your Node.js app is hosted:

CMD console in Windows Azure App Service

Additional Resources

SQLite Client for Node.js Apps on GitHub
Membership Database Boilerplate for Web Apps
SQLite Documentation, e.g. SQL Syntax, Data Types etc.
Single User Database Performance: SQLite vs SQL Server
Creating your first Node.js app in Azure

--

--

Bringing the technical edge to early-stage companies with advice on software architecture, best practices, database design, web infrastructure, and DevOps.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Konstantin Tarkus

Konstantin Tarkus

1.6K Followers

Bringing the technical edge to early-stage companies with advice on software architecture, best practices, database design, web infrastructure, and DevOps.