@stackit/stackit-cli
v1.1.84
Published
creating a template
Downloads
2
Keywords
Readme
Stackit-CLI
About
The Stackit-CLI project is a Node.js command-line interface (CLI) tool for interacting with the Stackit templates.
The tool allows the creation, selection, and deployment of project backend and frontend with a standard configuration and the creation of cloud resources.
The project's main objective is to provide an easy and quick way to build internal projects for the Stackit group from the command line.
Built With
Frontend Technologies
Backend Technologies
Cloud Technologies
UI Frameworks
Getting Started
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Install
npm i @stackit/stackit-cli -g
This package supports Node 10 and above
Create a new project Once it’s finished, you will be able to create a new project by typing in your console/shell
stackit-cli
A prompt will appear on your terminal. Here you can select the stack and technologies you wish to implement in your project
Note: You do not need to install everything at the start of your project. You can install certain modules using flag commands after a project is created.
Install Yarn packages
cd newProject cd nextjs or cd nestjs yarn install
Enter your APIs in
/terraform/variables.tf
variable "API_KEY" { type = string default = "" description = "ENTER YOUR DESCRIPTION" }
Enter your API in
.env
API_KEY = 'ENTER YOUR API'
Options
There are additional modules to implement with the Flags/Options:
-h, --help
Provide the options available to you.-r, --redis
Implement redis in the project in your NestJS as an example mode in addition to adding the redis service in docker.-g, --google-analytics <key>
Integrate Google Analytics automatically into your NextJS.-na, --next-auth
Next Auth login module implementation to your NextJS.-v, --version
Provides the current version of Stackit CLI.
Run Example
Example .ENV local project
The env variables will depend on each project, this is a basic example.
# .env
$ DB_TYPE=postgres
$ DB_HOST=localhost
$ DB_PORT=5432
$ DB_USERNAME=postgres
$ DB_PASSWORD=postgres
$ DB_NAME=<yourdbname>
$ POSTGRES_SYNC=true
$ JWT_SECRET=TOP_SECRET_EXAMPLE
$ [email protected]
$ PGADMIN_DEFAULT_PASSWORD=admin
$ PGADMIN_LISTEN_PORT=80
# Terraform .env
$ AWS_ACCESS_KEY=""
$ AWS_SECRET_KEY=""
Running the app
# development
$ yarn start
# watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
Test
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:cov
Naming Convention and Folder Structure
- Configuration
- [fileName].config.ts
- Constants
- [fileName].constants.ts
- Enums
- [fileName].enum.ts
- Services
- One on each folder (named as dash-case)
- [fileName].service.ts
- Types
- [fileName].types.ts
- Utils
- [fileName].util.ts
- [CamelCaseFolder]
- [CamelCaseFile].tsx
- app
- actions
- [myActionFolder]
- [myActionFile].ts
- [myActionFile].spec.ts
- process
- commands
- [myCommandFolder]
- [myCommandFile].command.ts
- [myCommandFile].command.spec.ts
- errors
- [myCommand].errors.enum.ts
- command.type.ts
- create-command.stack.ts
- services
- [myServiceFolder]
- myServiceInterface.service.ts (for interfaces)
- myService.service.mock.ts (for mocks)
- myService.service.ts (for the service)
- store
- app.slice.ts
- [myExtraReducer].extraReducers.ts
- [extraReducerAction].ts (follow the structure)
- auth
- Same that on app folder
- icons
- [myIcon].[imageFormat]
- Note: If it's an image that will be used on many sites, just add it to the root path with a dash-case. Otherwise, add a folder with the name of the page where it'll be used (in the dash-case case as well) and add it.
- [MyFolder]
- [MyFile].tsx
- Wrapper.tsx (required)
- Hooks
- [myHook].ts
- ui
- ui.slice.ts
- store.ts
- Globals css at the root path (using dash-case)
- Add a folder with the page where the style will be used and the file inside (both of them with dash-case)
- controllers
- [controller].controller.ts
- decorators
- [decorator].decorator.ts
- dto
- [dto].dto.ts
- guards
- [guard].guard.ts
- services
- [service].service.ts
- strategies
- [strategy].strategy.ts
- dto
- [dto].dto.ts
- exceptions
- [exceptionTypeFolder]
- [exceptionType].exception.ts
- middlewares
- [middleware].middleware.ts
- pipes
- [pipe].pipe.ts
- providers
- [provider].provider.ts
- constants.ts
- [configFile].config.ts
- [enum].enum.ts
Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request