# Quickstart

#### Installation using Arcend CLI

{% code title="PowerShell / Terminal" %}

```
npm install -g @arcend/cli
arcend create <projectname>
```

{% endcode %}

#### Installation and project structure

1. Install main package&#x20;

   ```bash
   npm install typescript ts-node @types/node @arcend/core
   ```
2. Setup project&#x20;

   <pre class="language-bash"><code class="lang-bash"><strong>npx tsc --init
   </strong></code></pre>

   ```
   *
   ├── tsconfig.json
   ├── package.json
   └── src
       ├── index.ts
       └── routes
           └── index.ts
   ```
3. Edit your tsconfig.json (Example below)

   ```json
   {
       "compilerOptions": {
           "module": "nodenext",
           "target": "esnext",
           "types": ["node"],
           "sourceMap": true,
           "declaration": true,
           "declarationMap": true,
           "noUncheckedIndexedAccess": true,
           "exactOptionalPropertyTypes": true,
           "strict": true,
           "jsx": "react-jsx",
           "verbatimModuleSyntax": true,
           "isolatedModules": true,
           "noUncheckedSideEffectImports": true,
           "moduleDetection": "force",
           "skipLibCheck": true,

           "rootDir": "src",
           "outDir": "dist"
       },
       "include": ["src/*", "src/**/*"]
   }
   ```
4. Edit your package.json (Example below)

   ```json
   {
     "name": "test",
     "version": "1.0.0",
     "description": "",
     "main": "index.js",
     "scripts": {
       "dev": "npx ts-node ./src/index.ts",
       "build": "npx tsc",
       "start": "node ./dist/index.js"
     },
     "keywords": [],
     "author": "",
     "license": "ISC",
     "type": "module",
     "dependencies": {
       "@arcend/core": "^1.0.1",
       "@types/node": "^25.0.10",
       "ts-node": "^10.9.2",
       "typescript": "^5.9.3"
     }
   }
   ```
5. Make some code in src/index.ts

   <pre class="language-typescript" data-title="src/index.ts"><code class="lang-typescript">import { Server } from '@arcend/core';

   const port: number = 4000;
   const sv: Server   = new Server({port: port, cors: 'http://localhost:3000'});
   sv.listen(async() => {
       await sv.loadRoutes('routes');
       console.log('API listening on: http://localhost:' + port);
   });
   </code></pre>
6. Create your first route in /routes

   <pre class="language-typescript" data-title="src/routes/route.ts"><code class="lang-typescript">import type { ArcRequest, ArcResponse } from "@arcend/core";

   const GET = async(req: ArcRequest, res: ArcResponse) =>
   {
       return {
           query: req.query,
           body: req.body,
           headers: req.headers,
           method: req.method,
           path: req.path
       };
   };
   export { GET };
   </code></pre>
7. Run dev script and test it

   ```bash
   npm run dev
   ```

   ```
   PS dir> npm run dev

   > @test@1.0.0 dev
   > npx ts-node ./src/index.ts

   API listening on: http://localhost:4000
   ```
8. Build it and run

   ```bash
   npm run build
   npm run start
   ```
