SQLITE in production
The thing is - most apps dont have enough traffic to make necessary real -con current writes. And with the command
PRAGMA journal_mode = WAL;
for concurrent writes with sqilite I really dont understand why I should use it in a project. (Disclamer for nerds)
I want to use sqlite in my nuxt application. Figured out the easiest way to deploy is within the server directory.
Is the server directory accessible from the public internet? Will nuxt break if i put a file .db in this directory? Ideally I want a location where apis can read from and since sqlite only manages file permission I must place the .db file in a path inaccessible form the public internet.3 Replies
Hi @IsaacR943. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, I can answer part of your question about using SQLite in a Nuxt application, specifically regarding the server directory. However, I don't have specific information about SQLite performance or deployment strategies within Nuxt.
The server directory in Nuxt is not directly accessible from the public internet. According to the Nuxt documentation on the server directory, this directory is used to register API and server handlers for your application. The files in this directory are processed by Nuxt to create server routes and API endpoints, but they are not served as static files.
Placing a .db file in the server directory should not break Nuxt. However, it's important to note that the contents of the server directory are used to generate the server-side logic of your application, not to serve static files.
For your use case of wanting a location where APIs can read from while keeping the file inaccessible from the public internet, the server directory could be a suitable location. The API routes you define in the server/api directory would be able to access the .db file, while the file itself would not be directly accessible to the public.
However, it's crucial to consider deployment and build processes. The Nuxt documentation on deployment mentions that Nuxt creates an .output directory when building for production. You should ensure that your database file is properly handled during the build and deployment process, as it's not a static asset that should be rebuilt each time.
For a more definitive answer on the best practices for using SQLite with Nuxt in production, including file placement and security considerations, you might need to consult additional resources or the Nuxt community forums, as the provided knowledge sources don't contain specific information on this topic.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@1223715160502571129> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
i could use nuxtignore to ignore the file at the server directory?