REDDIT 原始帖子

Best practices for Javascript Local Dev Environment

I'm currently developing an internal tool to do work reporting. I know a lot of tool exists, but we do have specific requirements and there's already an MS Access database, which I can migrate into the new tool as well as use most of the tables as a data…

原帖正文r/webdev

I'm currently developing an internal tool to do work reporting. I know a lot of tool exists, but we do have specific requirements and there's already an MS Access database, which I can migrate into the new tool as well as use most of the tables as a data source. About me: I have experience with Javascript, HTML, CSS/SCSS/SASS, PHP, SQL. I want to optimize it, but since I mostly code in my freetime, I find it hard to make "the right decisions" in terms of efficiency. Maybe you guys might recommend me something about my setup. I don't want to use anything like Angular, React and Vue at the moment. Also no NextJS as I think it's overkill. At the moment, I have a structure like: - API (ExpressJS, SQLite, Drizzle ORM) --> Delivering all data as needed in frontend (also annual reports and stuff) - Frontend (Vite for live-reload/server, Vanilla JS with own templating engine and router) --> Employees log in to keep track of their working hours per project/customer --> Dashboard for admin users to create reports All this run's in a docker with two services. It currently runs alright, but I think there might be a few little things to optimize my setup. Especially when going into production. What's your best practices? I want all this stuff to be as lean as possible without a lot of dependencies. My frontend doesn't need anything since I've already done all of the things, but I'm not very happy with the API/Backend part. I also don't want to run every service on it's own, since using one docker command is fine. Live codeing while docker is running also works fine so far (except when installing new packages via npm, then I need to rebuild). What would you do to optimize the setup? Already asked AI but I think you guys might have better inputs.

已收录讨论

4 条评论

u/Over_Tart_916

I read the entire post and I have no idea what you want. Personally, I only use docker for deployment. It is just too messy and time consuming to use it in development. I use Vite and NPM workspaces with a monorepo for pretty much everything concerning local development. It would be helpful if you asked any direct questions about what you want to improve. Based on your post I have no idea what you are doing or what you want.

u/scepticoreOP

I reread the post and you're right. I have a monorepo with subdirectories for each my backend and my frontend. So I can simply use `docker compose up` to start everything at once. Concrete questions: - Is there anything I might optimize? - When bundling, what do I need to take care of? E.g. rendering HTML-templates - When going into production in a VM for example, npm install doesn't properly work. Therefore, my JS needs to be bundled, so all dependencies work fine, right?

u/scepticoreOP

You hit quite the spot. I just want that piece of software to be reliable and fast. The team currently uses a 5 year old Access Database over network with firewall. Performance is absolute garbage. It takes about 1-2 minutes to start up the frontend and if an employee wants to create a new record to track working hours, it takes another 1-2 minutes. Sometimes Access freezes completely up to a few minutes before they can continue. We're talking about less than 10 employees and they're not on the tool simultaneously and since SQLite is a simple file which can be backed up quite fast, it was my first choice. I once heard that even though it's called "SQLite" that it's quite powerful. I also use an autosave functionality, so when an input field has changed, it sends a POST request to the database to instantly update the field on given row.

u/Think_Agent_1346

I don't think their setup is all that weird honestly, Express + Vite in docker is pretty standard for a lot of folks. sounds like they just want a sanity check on whether they're missing something obvious before they push it out. maybe the one thing I'd poke at is the SQLite choice if this thing is gonna have more than a few users hitting it at once. but if it's a small internal tool and the load is light, probably fine.