diff --git a/.gitignore b/.gitignore
index 409608f..20f06d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 cache/
 photo_cache/
 /photos_path
+photoview.db
 
 .env
 
diff --git a/api/database/database.go b/api/database/database.go
index 1ea5e1e..4c1e02e 100644
--- a/api/database/database.go
+++ b/api/database/database.go
@@ -4,18 +4,18 @@ import (
 	"log"
 	"net/url"
 	"os"
+	"strings"
 
 	"github.com/photoview/photoview/api/graphql/models"
 	"github.com/pkg/errors"
 
 	"gorm.io/driver/mysql"
+	"gorm.io/driver/sqlite"
 	"gorm.io/gorm"
 	"gorm.io/gorm/logger"
 )
 
-// SetupDatabase connects to the database using environment variables
-func SetupDatabase() (*gorm.DB, error) {
-
+func getMysqlAddress() (*url.URL, error) {
 	address, err := url.Parse(os.Getenv("MYSQL_URL"))
 	if err != nil {
 		return nil, errors.Wrap(err, "Could not parse mysql url")
@@ -30,15 +30,36 @@ func SetupDatabase() (*gorm.DB, error) {
 	queryValues.Add("parseTime", "true")
 
 	address.RawQuery = queryValues.Encode()
+	return address, nil
+}
 
-	log.Printf("Connecting to database: %s", address)
+// SetupDatabase connects to the database using environment variables
+func SetupDatabase() (*gorm.DB, error) {
 
 	config := gorm.Config{}
 
 	// Enable database debug logging
 	config.Logger = logger.Default.LogMode(logger.Info)
 
-	db, err := gorm.Open(mysql.Open(address.String()), &config)
+	var databaseDialect gorm.Dialector
+	switch strings.ToLower(os.Getenv("PHOTOVIEW_DATABASE_DRIVER")) {
+	case "mysql":
+		mysqlAddress, err := getMysqlAddress()
+		if err != nil {
+			return nil, err
+		}
+		log.Printf("Connecting to database: %s", mysqlAddress)
+		databaseDialect = mysql.Open(mysqlAddress.String())
+
+	case "sqlite":
+		path := os.Getenv("PHOTOVIEW_SQLITE_PATH")
+		if path == "" {
+			path = "photoview.db"
+		}
+		databaseDialect = sqlite.Open(path)
+	}
+
+	db, err := gorm.Open(databaseDialect, &config)
 	if err != nil {
 		return nil, errors.Wrap(err, "could not connect to database")
 	}
diff --git a/api/go.mod b/api/go.mod
index eedc1cc..413a943 100644
--- a/api/go.mod
+++ b/api/go.mod
@@ -22,5 +22,6 @@ require (
 	gopkg.in/vansante/go-ffprobe.v2 v2.0.2
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gorm.io/driver/mysql v1.0.3
+	gorm.io/driver/sqlite v1.1.4
 	gorm.io/gorm v1.20.8
 )
diff --git a/api/go.sum b/api/go.sum
index 0d6b6c9..d46106e 100644
--- a/api/go.sum
+++ b/api/go.sum
@@ -54,6 +54,8 @@ github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007/go.mod h1:9ELz6aaclSIG
 github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
 github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
 github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ=
+github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
 github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 github.com/mitchellh/mapstructure v1.4.0 h1:7ks8ZkOP5/ujthUsT07rNv+nkLXCQWKNHuwzOAesEks=
 github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
@@ -121,7 +123,10 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
 gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
 gorm.io/driver/mysql v1.0.3 h1:+JKBYPfn1tygR1/of/Fh2T8iwuVwzt+PEJmKaXzMQXg=
 gorm.io/driver/mysql v1.0.3/go.mod h1:twGxftLBlFgNVNakL7F+P/x9oYqoymG3YYT8cAfI9oI=
+gorm.io/driver/sqlite v1.1.4 h1:PDzwYE+sI6De2+mxAneV9Xs11+ZyKV6oxD3wDGkaNvM=
+gorm.io/driver/sqlite v1.1.4/go.mod h1:mJCeTFr7+crvS+TRnWc5Z3UvwxUN1BGBLMrf5LA9DYw=
 gorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
+gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
 gorm.io/gorm v1.20.8 h1:iToaOdZgjNvlc44NFkxfLa3U9q63qwaxt0FdNCiwOMs=
 gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
 sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
