# Create Server

This guide will walk you through creating a simple HTTP server using **FhyTS**.

## Project Structure

You can start a simple project with a structure that looks like this:

```bash
my-app/
├── server.ts        # Application entry point
├── tsconfig.json    # TypeScript configuration
└── package.json     # Dependencies and scripts
```

## TypeScript Configuration

FhyTS is TypeScript-based, so you'll need a tsconfig.json file in your project root:

```json
{
  "compilerOptions": {
    "target": "es2020",
    "module": "commonjs",
    "esModuleInterop": true,
    "rootDir": "./",
    "outDir": "./dist",
    "strict": true,
    "moduleResolution": "node",
    "skipLibCheck": true,
    "baseUrl": "."
  },
  "include": ["**/*"]
}
```

> This configuration ensures your TypeScript projects can compile and run smoothly with fhyts.

## Creating a Server

Create a file named server.ts with the following contents:

```javascript
import { FhyEngine, Logger } from 'fhyts';

async function Server() {
  try {
    const port = 3000;

    // Running the server
    Logger.info(`Starting server on http://localhost:${port}`);
    await FhyEngine.getInstance().start(port);
  } catch (err) {
    Logger.error('Server failed to start:', err);
  }
}

Server();
```

## API Reference

| Function / Class                     | Description                                                  |
| ---------------------------------- | ---------------------------------------------------------- |
| `FhyEngine.getInstance()`          | Retrieving a singleton instance from the fhyts engine.            |
| `Logger.info(message)`             | Displays log information to the console.                       |
| `Logger.error(message, err)`       | Displays error logs to the console.                           |

## Running the Server

Run the following commands to compile TypeScript and run the server:

```bash
npx tsc
node dist/server.js
```

If successful, you will see output like:

```bash
[INFO]: Starting server on http://localhost:3000
```

## Next

Once the server is running successfully, you can proceed to [Routes](#routes).