{"id":26469822,"url":"https://github.com/ocdbytes/express-and-typescript","last_synced_at":"2025-03-19T17:09:31.085Z","repository":{"id":113749515,"uuid":"466539515","full_name":"ocdbytes/Express-And-Typescript","owner":"ocdbytes","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-05T18:45:04.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-14T10:46:07.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ocdbytes.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}},"created_at":"2022-03-05T18:44:04.000Z","updated_at":"2022-03-05T18:45:07.000Z","dependencies_parsed_at":"2023-05-16T04:01:27.576Z","dependency_job_id":null,"html_url":"https://github.com/ocdbytes/Express-And-Typescript","commit_stats":null,"previous_names":["ocdbytes/express-and-typescript"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocdbytes%2FExpress-And-Typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocdbytes%2FExpress-And-Typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocdbytes%2FExpress-And-Typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocdbytes%2FExpress-And-Typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocdbytes","download_url":"https://codeload.github.com/ocdbytes/Express-And-Typescript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244470251,"owners_count":20457908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-03-19T17:09:30.314Z","updated_at":"2025-03-19T17:09:31.073Z","avatar_url":"https://github.com/ocdbytes.png","language":"TypeScript","readme":"# Steps to initialize a typescript express project\n\n```shell\nnpx tsc --init\nyarn init\nyarn add ts-node-dev typescript -D\n```\n\n- Add the script to package.json\n\n```json\n\"scripts\": {\n        \"dev\": \"ts-node-dev --respawn --transpile-only src/app.ts\"\n}\n```\n\nInstall these also\n\n```shell\nyarn add @types/node @types/express -D\n```\n\nInstall helmet for more application security\n\n```shell\nyarn add helmet\n```\n\n```js\nimport helmet from \"helmet\";\napp.use(helmet());\n```\n\n## Recommended Application Structure :\n\n1. create **routes.ts** file for storing all the routes\n\n```js\n// In routes.ts\nimport { Express } from \"express\";\nfunction routes(app: Express) {}\n// In app.ts\nroutes(app);\n```\n\n2. Controllers Folder will contain all the functions to be executed in routes\n\n3. Services Folder will contain all the function for making database calls.\n\n4. Models folder will contain all the database schemas\n\n**Import Heirarchy**\n\n```\nModels -\u003e Services -\u003e Controllers -\u003e Routes\n```\n\n## Some Extra folders :\n\n- Utils : For extra utilities\n- Middleware : For our middleware functions\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focdbytes%2Fexpress-and-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focdbytes%2Fexpress-and-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focdbytes%2Fexpress-and-typescript/lists"}