vlang / vpm

V's package manager
https://vpm.vlang.io
GNU General Public License v3.0
117 stars 30 forks source link

Refactor codebase #104

Closed xy3 closed 1 year ago

xy3 commented 1 year ago

Refactor codebase

What:

New project structure:

src
├── cmd               # Command line tools
│   └── migrate
├── config
│   └── config.v
├── entity            # Entity type definitions e.g. Package
│   ├── category.v
│   ├── package.v
│   └── user.v
├── repo              # Repositories that handle database interaction. Database dependent and end with '_<database name>.v'
│   ├── package_postgres.v
│   └── users_postgres.v
├── templates
│   ├── assets
│   ├── components
│   ├── index.html
│   ├── ...
│   └── search.html
├── usecase           # Use cases that handle business logic for the API + website endpoints. Usecases use repository interfaces to interact with stored data. They shouldn't need to, or otherwise, depend on each other.
│   ├── package
│   └── user
├── app.v             # Contains the 'endpoints' i.e. pages for rendering the VPM webpage e.g. index()
├── auth.v
├── category.v
├── main.v
├── package.v         # The rest of the V files in src are handlers for the API. Each endpoint should be a subpath of '/api' as to not interfere with webpage endpoints
└── search.v

Demo to test everything works:

https://github.com/vlang/vpm/assets/32339757/b2555285-adad-47a3-842a-95253bbe44d4

Todo:

medvednikov commented 1 year ago

Hey

Thanks, can you add screenshots and a summary with the changes? Thanks.