title: NestJs - Angular - Deployment strategy
body: <p>I've developed a small application for a factory that had a specific need. It's a small application which will be used locally by less than 10 people.</p>
  
  <p>For now, I've my backend and frontend in the same git repository.</p>
  
  <p>Repository structure looks like this</p>
  
  <pre><code>--README.md
  --.gitignore
  --document
  --projects
    |--backend        // Nestjs API
    |--frontend       // Angular
  </code></pre>
  
  <p>I've prepared NestJS to serve static files, which means I've configured my Angular builder to work as follow:</p>
  
  <p><em>angular.json</em></p>
  
  <pre><code>...
  "options": {
      "outputPath": "../backend/client/dist",
      "index": "src/index.html",
      "main": "src/main.ts",
      "polyfills": "src/polyfills.ts",
      "tsConfig": "tsconfig.app.json",
      "aot": true,
  ...
  </code></pre>
  
  <p>My NestJs server is configured to serve static files :</p>
  
  <p><em>main.ts</em></p>
  
  <pre><code>const PORT = process.env.PORT || 8080;
  async function bootstrap() {
     const app = await NestFactory.create&lt;NestExpressApplication&gt;(AppModule);
     app.enableCors();
     app.setGlobalPrefix('api');
     await app.listen(PORT);
  }
  ...
  </code></pre>
  
  <p><em>app.module.ts</em></p>
  
  <pre><code>imports: [
      TypeOrmModule.forRoot(),
      ServeStaticModule.forRoot({
        rootPath: join(__dirname, '..', 'client/dist'),
      }),
  </code></pre>
  
  <p>Until today, I used npm with <code>npm run start:dev</code>, which allow me to automatically build my database and run the backend server.
  Now, I need to deploy my backend and frontend into the same server and build everything.</p>
  
  <p>What is the best approach ?
  Should I first build angular into the dist folder, build nestjs .. 
  I can only take the dist folder onto the production server right ? </p>