DEV Community

Discussion on: How do you structure your Projects ? 🗃️📦️

Collapse
 
yjdoc2 profile image
YJDoc2

My usual structuring is :

C : Keep all files and headers in single folder, if project is small and does not contain many source files, otherwise split the files according to use (utility, data structures etc) and make individual folder+makefile for each

node+express+Mongoose : index.js in root which sets up routes, db connection,middlewares etc. and starts server ; Models folder for Mongoose models, utils folder if I have some modular utility functions that can be used in multiple projects, config folder for storing DB, Authentication etc config files, routes folder containing individual files for each major routing path (/user, /admin, /api etc.) and each sets up functions and routes and then exports the routers. If using server-side rendering, then a views folder for views.

python : main/user interface containing files in root, and then other functions/classes split in modules/ individual folders as per needed

Rust : For binary, main.rs in root and related files in bin/ folder, and for a lib, lib.rs in root exporting the interface of library and core folder containing all library's core code, which itself is split according to use in folders. (I'm still exploring structuring for Rust, not sure this is a good way or not)