Open taki-tiler-server[bot] opened 1 month ago
Finish
In this step, you'll connect your code with the database and create your first table using only Typescript 😎.
Do we have libraries to access our database? Of course we do. We use ORMs to make our work easier by writing Typescript to perform queries to the database. We'd like you to use the same ORM that is used on the project you're going to work, , so if you don't know yet which ORM you should use, please ask your tutors. Some time ago, our main ORM was TypeORM. Now we are more focused on Prisma, but we always keep an eye on the trends so it can even be a third one.
docker-compose.yml
.start
code. For now, you can connect only with your local database, leaving the test connection for later.Note: don't forget to check if your docker container is running before connecting to the DB, otherwise it will fail.
Now you can ask: "Do they have a tool to manage the data inside the database without code?" Of course we do, young padawan. Actually, we recommend these two apps:
Feel free to choose one of these above, or any other app you want :D
After successfully connecting the ORM to your database, it's time to see it working by creating your first table. Guess what? It will be called User
(we told you so)
Note 2: too much for one step? Don't get stuck and feel free to ask anything to any Taqtiler 👍
Now open a pull request for your feature/setup-database
branch.
Finish
Remember you created a README.md
file. Now it's time to populate it. Fill the blank topics that were left before. Create a branch named docs/update-readme
and fill in the info you left blank before. Open a pull request for this branch after finished.
- Project's Name
- Project's Description
- Environment and tools *
- Steps to run and debug *
TIP: an excellent README is that one document that is sufficient for any developer to be able to run and contribute to your project.
NOTE 2: For now on, you're going to create branches and Pull requests on your own. Pick good and clear branch names and try to open Pull Requests for one or only few steps. It's not a good practice to have too much code on a PR. 😅
Finish
Here in Taqtile, before merging our revised (and approved) branches, we rebase it into the one we are attempting to merge. In this case, you'll rebase feature/setup-graphql
to develop
.
Too confusing? Here are some good links you can read about rebase:
Note: after your feature/setup-database
is approved, you'll repeat this process.
The ideal setup we are trying to achieve with the rebases are something like below.:
Finish
Click here for your next track
Step 1/4 - Containers everywhere
Estimated time: 2 hours
[Spoiler alert]: in the end of this onboard, you'll basically develop a CRUD of an entity called
User
. So, in order to store the user data in our app, let's create a real database.The database we use on most of our projects is PostgresSQL, an open-source relational database.
Creating the database containers
feature/setup-database
for the next 2 steps.There are a lot of setup so far right? In order to reduce the project setup time, we use Docker containers to create a database to work locally while developing. We'll create 2 databases: one for running server locally and another for (spoiler alert 2) the tests. Yeah, we will write tests. 🤓
First, make sure you have Docker installed on your machine. Just hit Command Space and type
Docker
. If not, you can download on their site.docker-compose.yml
file on your root project folder.docker-compose.yml
file. You can use this example if you want, just replace the values onenvironment
fields.$ docker compose up -d
on terminal to mount your containers.Note: Before run
docker-compose
commands, make sure that the docker is running on your mac. You can use again Command Space, typeDocker
and hit Enter.Note 2: If you want to stop your containers, you can run
$ docker-compose stop
command in your project's root folder.