# Web API

The web API enables User Login and storing user data online. It is optional and turned off by default. Once you are familiar with the TCG Engine, you can start installing it to turn on some additional features:

* User Authentication (with password)
* Database to save all user data online (card collection, decks, packs, coins...)
* Leaderboard and ELO Ranking
* Friend list

The API is made with NodeJS and uses a Mongo Database. Other apps can access the API by sending HTTP requests. For example a request to Register a user, Login, Edit your deck, or give rewards. Some of the requests require elevated privileges, for example the Give Reward request cannot be performed by a regular user. Your unity game server can have its own credentials to access the api.

The advantage of this type of API, as opposed to have the whole server managed by Unity. Is that it allows different app to access the api. For example if you later decide to have a website and want to show user accounts or cards there, your website could simply connect to the API and access all the data.&#x20;

Also this allows you to have separate servers for the API where everything is saved, and for your game server. The Game server can require much more processing power than a NodeJS app. So for this reason if you get a lot of users, you may need to have multiple game server, without fragmenting your data since they can all access the same API.

So in short, Unity is better for real-time server and executing game logic, where a lot of data and code is shared with the client. But NodeJS is much better and more performant for creating an independent http API with database that isn't so much related to the gameplay.

![](https://2533758046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjsBgAenEXusKcO8RelBI%2Fuploads%2FOrMOvCaDNRvY95GIBU4U%2FServerSetup-TCG.png?alt=media\&token=db302084-7171-4dff-814d-08c4950c4aa9)
