Get-Job is a freelancer platform created as an internship project at Zenbit Tech
Before starting, make sure you have at least those components on your workstation:
- An up-to-date release of NodeJS and NPM
- A MySQL database installed locally. Or you may use the provided docker-compose file.
Docker may also be useful for advanced testing and image building, although it is not required for development.
Clone the project and install its dependencies:
$ cd HiveIn_be
$ git clone git@github.com:ZenBit-Tech/HiveIn_be.git
$ npm installOnce the dependencies are installed, you can now configure your project by creating a new .env file containing your environment variables used for development.
$ cp .env.example .env
$ nano .envFor a standard development configuration, you can leave the default values for all variables under the API, Client side and Upload sections.
Next comes to the Database configuration: change everything according to your own database setup.
If you wish to leave everything as default, run docker compose to create your database instance and phpMyAdmin, a tool intended to handle MySQL administration through the web:
$ docker-compose upNow you can access your database information with phpMyAdmin, which is also running in the same container by accessing localhost using port 8080
Last but not least, define a JWT_SECRET to sign the JWT tokens or leave the default value in a development environment.
You are now ready to launch the NestJS application using the command below.
# Perform migrations in your database using TypeORM
$ npm run typeorm:run-migrations
# development
$ npm run start
# watch mode
$ npm start:dev
# production mode
$ npm run start:prod# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:covHead over the link http://localhost:4000/api/ to see the documentation.
Head over the link http://localhost:4000/api-json/ to download the documentation.
Most of the routes are protected by authorization (1)
Proceed with auth first and paste the accessToken to the field, by pressing the button Authorize (2) and (3)
To check what SQL queries schema:sync (next command) is going to run use:
npm run typeorm:schema:log
To synchronize a new database with the current schema use:
npm run typeorm:schema:sync
Be careful running this command in production - schema sync may cause data loss if you don't use it wisely. Check which SQL queries it will run before running on production.
npx typeorm migration:show
[X] = Migration has been ran
[ ] = Migration is pending/unapplied
This command also returns an error code if there are unapplied migrations.
Once you change the database schema, it's important to generate a new migration with either through TypeORM CLI or manually
npm run typeorm:generate-migration --name=TableRefactor
npm run typeorm:create-migration --name=TableRefactor
To execute all pending migrations use following command:
npm run typeorm:run-migrations
This command will undo only the last executed migration. You can execute this command multiple times to revert multiple migrations. Learn more about migrations
To revert the most recently executed migration use the following command:
npm run typeorm:revert-migration
The website is currently being hosted in a Digital Ocean server.
- Domain: http://getjobhivein.me
We're using external services such as a MySQL RDS, Redis and a S3 bucket.
