-
Notifications
You must be signed in to change notification settings - Fork 541
Code and file structure overview
.circleci/
: This contains the CircleCI config for running tests. In this folder, the tests start from doTests.sh
which runs all the unit tests for the core with MySQL and MongoDB - one database for each type of plugin interface. The tests run whenever a dev tag is added to a commit. Dev tags have the format of dev-vX.Y.Z
where X.Y.Z
is the version of the core in that commit.
cli/
: This folder contains the java source code for the SuperTokens CLI. The important parts in cli/src/main/java/io/supertokens/cli/
:
-
Main.java
: Where the program starts. -
cliOptionsParsers
: Contains the class that parses the CLI arguments and makes it easily queriable by other parts of the source code -
commandHandler
: Contains handlers for each type of command that the CLI accepts -supertokens <command>
. -
commandHandler/CommandHandler.java
: Theabstract class
that's inherited from for each command.
downloader/
: This folder contains the java source code for installing all the 3rd party JAR dependencies. It's relevant only if the SuperTokens is downloaded via our servers. If building from source, this source code is not needed. The important parts in downloader/src/main/java/io/supertokens/downloader/
:
-
Main.java
: Where the program starts. This essentially queries the SuperTokens servers to get the list of dependencies for the current version. These dependencies can be found inimplementationDependencies.json
jar/
: This folder contains the JAR for the core. It's not a fat JAR (i.e. it doesn't contain the dependency JARs in it)
build.gradle
: This file is used by gradle
to build the JARs. It contains information like:
- The current version
- 3rd party dependencies
config.yaml
: This is the empty config file that is shipped to the user. Using this, they can define the behaviour of SuperTokens as per their use case.
coreDriverInterfaceSupported.json
: This file contains the versions of the core driver interfaces (CDI) that this core supports. To learn more about CDIs, see the architecture page.
devConfig.yaml
: This is the config file that is used to run SuperTokens during testing. If all tests should be run with a certain config value, then this file should be edited before running the tests.
implementationDependencies.json
: This file contains a list of all 3rd party dependencies and a link for where to get them from. Each dependency can be download with or without their source. It is used by our servers in the downloader
program.
install & install.bat
: These are scripts for installing SuperTokens on a Linux/Mac (install
) and a Windows (install.bat
) machine. They are used to manually install SuperTokens after downloading the ZIP from our website. If you want to build from source, you do not need these files.
pluginInterfaceSupported.json
: This file contains the versions of the plugin interfaces that this core supports. To learn more about this interface, see the architecture page.
src/main/java/io/supertokens/
: This contains the source code of the core. The explanation of some of the files / folders are:
-
Main.java
: This is where the program starts. It loads theconfig.yaml
file, starts a few cronjobs, starts the webserver and adds listeners for the kill signal. -
cliOptions/
: Responsible for loading the CLI options passed to this program. The options specify the location of the install directory, the port and host to bind on etc.. -
config/
: Contains classes that load, verify and store the contents of theconfig.yaml
file -
inmemorydb/
: This has an implementation of an in memory database using SQLite. It enables us to run the core without any actual underlying database. Like all database plugins, it must conform to a plugin interface. -
session/
: Contains the core logic for managing session tokens -
storageLayer
: Is an abstraction of the underlying storage being used. -
webserver/
: Contains the code for registering routes and their logic. -
emailpassword/
: Contains the core logic for emailpassword recipe
There are other files as well...
src/test/java/io/supertokens/test/
: This contains the source code of the tests for the core. Each module has its own tests, and each version of each API has its own tests.