{"id":16113011,"url":"https://github.com/guilospanck/inter-week-backend","last_synced_at":"2026-01-19T09:02:48.910Z","repository":{"id":36981908,"uuid":"435982691","full_name":"Guilospanck/Inter-Week-Backend","owner":"Guilospanck","description":"This is the backend part  based on the \"Frontend Inter Week\" series. The main goal of this series is to develop a copy of the web interface from Banco Inter.","archived":false,"fork":false,"pushed_at":"2023-02-28T03:10:00.000Z","size":1487,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T16:53:52.455Z","etag":null,"topics":["asymmetric-cryptography","clean-architecture","clean-code","jose","jwt","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Guilospanck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-07T18:14:26.000Z","updated_at":"2022-12-14T14:47:31.000Z","dependencies_parsed_at":"2024-10-27T17:29:36.964Z","dependency_job_id":"433670b4-b13e-4dc4-b545-c8b999fbb8de","html_url":"https://github.com/Guilospanck/Inter-Week-Backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Guilospanck/Inter-Week-Backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2FInter-Week-Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2FInter-Week-Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2FInter-Week-Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2FInter-Week-Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Guilospanck","download_url":"https://codeload.github.com/Guilospanck/Inter-Week-Backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2FInter-Week-Backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asymmetric-cryptography","clean-architecture","clean-code","jose","jwt","nodejs","typescript"],"created_at":"2024-10-09T20:09:57.657Z","updated_at":"2026-01-19T09:02:48.883Z","avatar_url":"https://github.com/Guilospanck.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inter-Week-Backend\nThis is the backend part based on the \"Frontend Inter Week\" series. The main goal of this series is to develop a copy of the web interface from [Banco Inter](https://www.bancointer.com.br/). However, here the series is used just as an example to be based on. Everything (from Project Structure, to coding, documentation, tests) is different.\n\nThe application provides signin and signup with asymmetrical keys using JWT and JOSE (the JWT token is encrypted. So, without the private key, people can't really know which information are in there). Also, we can make money transferences between the participants (known in Brazil as PIX).\n\n\u003cp align=\"center\"\u003e\n➡️ 👷🚧 \u003cb\u003eUnder Construction...\u003c/b\u003e\n \u003c/p\u003e\n\n## Technologies\n- Node.js\n- Express\n- TypeORM\n- PostgreSQL\n- Clean Code Architecture\n- Design Patterns\n- JWT\n- JOSE (JSON Object Signing and Encryption)\n- Jest\n\n## Project Structure\nI'm using \u003cb\u003eClean Code Architecture\u003c/b\u003e for this project. The reason is because it provides a nicer and better way of changing and maintening the code, besides providing us the best out of \u003cb\u003edesign patterns\u003c/b\u003e and \u003cb\u003eS.O.L.I.D. principles\u003c/b\u003e.\n\nThe goal is to have the code at the best readability possible and to have layers detached from each other. We must not be a slave to some library, some outside module or to some other part of our code.\n\nBelow we have the architectural names used for this project and their basic explanations.\n\n```\n\n├── applications\n│   ├── errors\n│   ├── interfaces\n│   └── usecases\n│       └── users\n├── business\n│   ├── dtos\n│   │   └── users\n│   ├── entities\n│   ├── errors\n│   └── usecases\n│       └── users\n├── infrastructure\n│   ├── adapters\n│   ├── database\n│   ├── http_server\n│   └── repositories\n│       └── user\n├── interfaces\n│   ├── controllers\n│   │   └── users\n│   └── middlewares\n├── mocks\n├── routes\n└── shared\n    └── utils\n```\n\n- ***Applications***: this layer is used for usecases rules. What we mean by that is that here lies all business cases related to the project. If an outsider look at our usecases, they must know what our project does even though they don't undestand it. So, for example, we have inside of \u003ccode\u003eUser\u003c/code\u003e the \u003cb\u003esignin\u003c/b\u003e and \u003cb\u003esignup\u003c/b\u003e usecases. An outsider will know that the User part of our project lies on getting a user signed in and signed up.\n\n- ***Business***: here we have all things related to our intrinsic company needs. In here we define the I/O structures, the entities for the databases and so on.\n\n- ***Infrastructure***: basically everything related to the outside lies here: a module (like `express, typeorm, logger`) and a database (like `postgres`). This is the part of our application that is using something external.\n\n- ***Interfaces***: this is our front door of the application. All requests will be redirected to this layer before it takes time into the interior of our project. He is the frontman that gives directions for the requests coming.\n\n- ***Mocks***: basically used for testing purposes. Here we'll have dummy mocked requests, objects, functions, classes in order to execute our unit tests.\n\n- ***Routes***: as the name describes, all our endpoints are located here.\n\n- ***Shared***: finally, this is the layer where we have something that can be used throughout the application, something that more than one layer will use.\n\n## Installation\nGit clone this repository\n```bash\ngit clone https://github.com/Guilospanck/Inter-Week-Backend.git\n```\nand then \u003ccode\u003ecd\u003c/code\u003e into it\n```bash\ncd /Inter-Week-Backend\n```\nRun Yarn to install dependencies\n```bash\nyarn\n```\nBe sure to have an instance of PostgreSQL up and running with the following credentials (you can see then in the `ormconfig.json` file):\n```json\n{\n  \"name\": \"default\",\n  \"type\": \"postgres\",\n  \"host\": \"localhost\",\n  \"port\": 5432,\n  \"username\": \"postgres\",\n  \"password\": \"123456\",\n  \"database\": \"inter\",\n  \"entities\": [\"src/business/entities/*.ts\"],\n  \"logging\": false,\n  \"synchronize\": true\n}\n```\nOne simple and quick way to have it running is to run it on Docker.\nOnce you have [Docker](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04) installed, you can run on the terminal:\n```bash\ndocker run --rm --name pg-docker -e POSTGRES_PASSWORD=123456 -e POSTGRES_DB=default -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres\n```\nAlso, personally, I like [DBeaver](https://dbeaver.io/) as a Graphical Interface to the database.\n\nThen, once the database is up and running and you already have a database there with the above configurations, you can run on the terminal:\n```bash\nyarn start:dev\n```\nto run the HTTP Server and the connection to the database.\n\n## Using the application\nOn the `docs/` folder we have the [Insomnia](https://insomnia.rest/) JSON file that can be imported and is ready to use.\n- First you have to do the user `signup` in order to create the user in the database (be sure to remember its credentials `email` and `password`;\n- Then create another user the same way. You do this in order to transfer money from one to another.\n- `Signin` with one of the users; get its `userId` and `accessToken` and put it on the Insomnia Environments (Ctrl E);\n\nExample:\n```json\n{\n\t\"BASE_URL\": \"http://localhost:4444\",\n\t\"TOKEN\": \"eyJyZWNpcGllbnRzIjpbeyJlbmNyeXB0ZWRfa2V5IjoibHE3cUpRR0J1Q1RtQzlYaWxEd1Y0Z0NsTkszUEk4UXd6am5NRnoxRWFrVVpYcEFRWUVjMnlNcVpPQ2VKdGtXY0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GhlcnRleHQiOiJaU0JuTks3RHJjVmdDUGExd0NOQzgzUVJGU1Q3NDFaTWpfLVh4SlBEbk85VnB0Tktnd0hfYkNuYlBJUFlRVlNwQVZ3Q19pZmxPZFZpVVlDZnNQT2t2TkRjbHZCUDEwMzRFY2xVMTFFV2t1WUFVU2ZjRjk4U1h1Z2hoZXdpS3NJR2xTd1pxQlVBM29HcTJtVlgyakI3UF9GeEVmdmdSTFU2STJjV3F6dndUMWFzcldjNndRS3V4Mjc5M3lLOVFFbG92ZUE2ZjBDQnpuZDlVUVdhUzBqbzlvemxNdU5ONEx1U3A4UnNvRC0zVHJ3RFdpajNVSEpSSmZtS1RVM1MxWGViWWJSaEpuNWtmMjdtTjVZTklheTJqM0JYSWhubTYxNUNkNFB4WlA3Mlg4a3FoVkxIM1RQOWFKRVNBWWRyWGpfV1lPZU95NllDYWNUaGgwc3FJLWR0RnZ1Zm5PSElqdG55WVNrOF9lemZ0cjhSa0FQRVM3T0JBM01TZ2xjak9uSnpUNm8xTlI3OXVWb2FGUzZaZnAydUNHcGFjaE54TEd1aXd2bG03TnFuM08tX1dXWXlzOVFycmRwU2FSS2FmT1NXb0ZsM1k1Q0RGcWRGMVJrcHJBZ3hyNVJlMl9qalFCTTJCb3RVeHN6a21NMk5UOHYzWkYxTEpRVjlBYV9fS1FVMTBBSUFNSjdzZU9pWTRHM3lVZnpWVlp2YlZmZUdKSVNzRm9VQnNZbFBCZEkiLCJ0YWciOiJSSHR3ZW9RLWNqdHRZdFhUNkU3WnhBIn0=\",\n\t\"USER_ID\": \"0aed60cb-a16a-429f-b429-169ff33040e9\"\n}\n```\n\n- Then, on the `Pix` section, `Request` a new payment of some value. Copy the `pixKey` returned. This is the code you'll use to pay with another user;\n- `Signin` with the other user, change the Insomnia environment with its credentials and then on the `Pix` section go to `Pay` and paste the `pixKey` from the previous step on the `key` field;\n- On your database now you should have a 'closed' transactions and users created.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilospanck%2Finter-week-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguilospanck%2Finter-week-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilospanck%2Finter-week-backend/lists"}