@space-uy/generator-space-backend
v2.1.0
Published
Yeoman generator for a typescript backend
Downloads
36
Readme
Space Backend
The following is a yeoman generator for a typescript backend, providing debugging and linting straight from Peritus-TS.
Quick Start
- Install yeoman if it isn't already installed:
npm install -g yo
- Install generator-space-backend:
npm install -g @space-uy/generator-space-backend
- Create a new repository and clone locally
- Go to local repository and run the following command:
yo @space-uy/space-backend
- Answer the wizard's questions
- Wait for packages to be installed...
- Get busy coding!
Note: If you run the wizard in a folder that isn't a repository, husky won't install properly.
Powered by Peritus-TS
A lot of the development features provided by this generator are from Peritus-TS. Take a look at the readme there if you wan't an explanation of the individual components that are available, such as debugging straight from typescript, and linting that is enforced even upon committing changes.
Current Version: 2 (Keystone)
Available features and backend structure may vary between different versions, so it's recommended to keep a copy of this readme in your project for future reference. If you intend on providing a readme specific to your project, feel free to rename this file to something like space-backend.md.
Features
Individual capabilities your backend can have are separated into features. By default, express is built-in since you wouldn't really have a backend without it (As such, it isn't considered a feature, but rather a core component to the backend).
For the current version, the available features are:
- Typegoose: A typescript layer of Mongoose. (Note: This feature will require you to include a uri to a MongoDB database as
DB_URI
in the .env file) - TypeGraphQL: A typescript layer of GraphQL.
- PassportJS: This feature is used for handling authentication. By default, it comes with Passport's Local Strategy
A List of available features can be accessed through the command: npm run dev:features:list
Add and remove features by calling: npm run dev:features
(--force skips overwrite confirmations)
Middleware
These can be added to express endpoints to provide intermittent functionality.
For the current version, the available middleware are:
- Requires: Checks that a request contains the specified queries, params and body
- WithAuth: Requires that a requester be authenticated in order to access an endpoint
A List of available middleware can be accessed through the command: npm run dev:middleware:list
Add and remove middleware by calling npm run dev:middleware
Roadmap
Current progress of this project, as well as planned additions, can be viewed on our trello board