Skip to content
  • Our Product
    • Namazu Elements
      • What is Elements?
      • Why open source?
      • Docs
        • Namazu Elements in Five Minutes or Less
        • RESTful APIs Library
        • Security Model
        • Accessing the Web UI (CMS)

    Our Product

    A logomark with three layered rhombuses adorning the lettermark that says Elements in bold all-caps sans-serif letters.
    • What is Namazu Elements? Discover our easy-to-use backend network solution built for online games. Rapidly enables full-scale multiplayer games or online solo adventures.
    • Why open source? Is there a truly open source server backend for connected games? There is now. Download and run a local copy of Namazu Elements and try it for yourself.
    Download Namazu Elements

    Get started

    • Quick start Read our Elements 5-minute quick start guide
    • Documentation Read our developer docs for learning more about Elements
    • RESTful APIs A full list of core API specs for working with the Elements framework
    • Security An overview of the server-authoritative security model of Elements
    • Accessing the CMS Manage your game with ease via the Namazu Elements CMS.

    Co-development Reimagined

    • Reduce your costs Would you rather outsource your backend development? Hire Namazu Studios to build your server backend with the power of Namazu Elements.
      Co-dev

    Recent Posts

    • The watercolor-styled Namazu Studios logo over a giant namazu lurking in the depth
      Namazu Studios Featured in San Diego Business Journal
      22 Sep 2025 Press
    • Namazu Elements 3.1 Released – Service Layer Fixes, Secure APIs, and Steam Bug Fix
      22 Apr 2025 Release Notes
  • Case Studies
  • About Us
  • News
  • Services
  • Book a call
namazu-studios-logo
Book a call

Getting Started

  • Namazu Elements in Five Minutes or Less
  • Accessing the Web UI (CMS)
  • CMS Feature Overview

Fundamentals

  • Why You Need a Server (and What “Authoritative” Means)
  • Elements as a Game Runtime
  • Where Your Authoritative Code Runs
  • Lifecycles and Flows

General Concepts

  • Overview
  • Custom Elements
  • Data Models
  • Security Model
  • N-Tier Architecture

Namazu Elements Core Features

  • User Authentication / Sign In
    • What is a User?
    • User Authentication in Elements
    • Auth Schemes
      • Auth Schemes
      • OAuth2
      • OIDC
  • Features
    • Applications
    • Sessions
    • Users and Profiles
    • Digital Goods
    • Progress and Missions
    • Progress and Missions (3.4+)
    • Leaderboards
    • Matchmaking – Comprehensive Guide
    • Followers
    • Friends
    • Receipts
    • Reward Issuances
    • Save Data
    • Metadata
    • Metadata (3.4+)
    • Queries
    • Web3
      • Wallets
      • Vaults
      • Omni Chain Support
      • Smart Contracts
        • Smart Contracts
  • Queries
    • Advanced Operators
    • Object Graph Navigation
    • Boolean Queries
    • Base Query Syntax
  • Advanced Operators
    • .name
    • .ref

Your Game Code - Adding Custom Elements

  • Custom Code Overview
  • Windows Setup
  • Mac OS Setup
  • Ubuntu Linux Setup
  • Element Anatomy: A Technical Deep Dive
  • Introduction to Guice and Jakarta in Elements
  • Structuring your Element
  • Events
  • Packaging an Element with Maven
  • Deploying an Element
  • Preparing for code generation
  • Properties
  • Websockets
  • RESTful APIs
  • Direct MongoDB Access (3.5+)

Configuration

  • Matchmaking – Comprehensive Guide
  • Direct Database Access and Batch Configuration
  • Batch Samples
    • Mission Upload Bash Script Sample
    • Item Upload Bash Script Sample

RESTful APIs

  • Importing into Postman
  • RESTful APIs Library
  • Swagger and Swagger UI

Add-Ons

  • Custom Elements
    • Crossplay
      • Namazu Crossfire (Multiplayer)
      • Deploying Namazu Crossfire in your game
  • Game Engines
    • Unity
      • Elements Codegen
      • Crossfire
    • Roblox
      • Roblox Overview
      • Secure Player Authentication & Registration
      • Global Matchmaking
      • Roblox Security Best Practices

Troubleshooting

  • Common Issues with Docker
  • Local SDK
    • Unable to deploy application : dev.getelements.elements.sdk.exception.SdkElementNotFoundException
    • Could not load class : java.lang.NoClassDefFoundError
  • Namazu Elements Community Edition
    • Common Issues with Docker
    • Unable to deploy application : dev.getelements.elements.sdk.exception.SdkElementNotFoundException
    • Running in the IDE
      • Exception in monitor thread while connecting to server localhost:27017
      • Could not deployAvailableApplications Jetty server Failed to bind to /0.0.0.0:8080 Address already in use

Releases

  • 3.6 Release Notes
  • 3.5 Release Notes
  • 3.4 Release Notes
  • 3.3 Release Notes
  • 3.2 Release Notes
  • 3.1 Release Notes
View Categories
  • Home
  • Docs
  • Your Game Code - Adding Custom Elements
  • Custom Code Overview

Custom Code Overview

Est. read time: 4 min read


Deploy custom code to your instance of Namazu Elements. #

Elements is highly extensible and allows you to develop custom code. Elements 3 is written in Java21 and therefore any VM compatible languages will work seamlessly in Elements. Building your custom server side logic in Java-Based Languages has several distinct advantages.

  • Java has one of the most complete ecosystems of readily available Open Source libraries available. Chances are, whatever you’re looking for is available in a package on Maven Central.
  • Java offers incredible server side performance through JIT Compliation, which essentially compiles your code to machine code as it is loaded.
  • As of October 2023, it is estimated that the developer community size is approximately 17.1 Million developers, ensuring you will have no problems building your team long-term.
  • An existing suite of powerful development tools including IDEs and profilers/benchmarking tools are readily available.

Check out our example Element project here!

Here’s where you learn to develop your first Element. #

Starting with Elements 3, we are now providing a way to develop custom extensions in Java Virtual Machine (or JVM) based languages. Refer to the Wikipedia page for a complete list and determine the best language which works for your project. The most popular choices are Java and Kotlin. Elements is natively written in Java which is 100% compatible with any other JVM based language.

We call our fundamental plug-in an Element. Each Element runs in an isolated environment using a ClassLoader which isolates Element from the rest of the system. A common problem Java developers face is conflicting dependencies within a single application, colloquially known as “Jar Hell.“

Our approach allows you to use develop in an environment without having to worry about conflicts between the Elements 3 code base and your Element’s code. We provide a set of interfaces, but isolate their implementations from your code. When developing an Element, these are the key points you must know:

  • You can incorporate almost any existing Java code base into Elements that are based on standard Java frameworks. Elements 3 Currently Supports:
  • Jakarta RS 4.0.0
  • Jakarta Websockets 2.1.0
  • You can include almost any third-party library into your code base without having to worry about it conflicting with the frameworks used to build Elements
  • Note: You will need to copy all dependencies into your Element, except those as provided by Elements 3.
  • An Element does not have strict isolation, nor does it run in a sandbox. This is by design, as trying to enforce strong encapsulation using a Security Manager (or similar) would introduce a lot of overhead for no benefits. Take special care when accessing the System ClassLoader.

Defining an Element #

An Element exists as a Java package and, optionally, include all sub-packages recursively. Elements are similar to JPMS Modules but without the one jar per module restrictions.

The following example shows how to define an Element in your Java code. Note we do require that you define a package-info for the package. The following is the simplest Element possible.

// Defines the Package. Specifies as recursive.
@ElementDefinition(recursive = true)
package com.mystudio.mygame.api;

// Imports the Element SDK Annotation
import dev.getelements.elements.sdk.annotation.Element

This indicates that the package com.mystudio.mygame.apiand all sub packages will be included in the Element for associated services.

Packaging an Element #

Packaging an Element or collection of Elements uses a simple directory structure. Elements 3.0 will search for the following files and directories when loading the assets associated with an Element:

  • dev.getelements.element.attributes.properties – A standard Java Properties file which define the Element’s application
  • libs – A directory containing jar files. The loader scans the directory for jar files and adds them to the Element’s classpath.
  • classpath – A directory containing assets to add directly to the Element’s classpath.

Additionally, the following rules apply when scanning a directory for Elements.

  • Any file not otherwise specified would be ignored.
  • Any directory will be treated as a new Element, provided that that at least libs or classpath exist.
  • Note: Elements defined in directories will inherit the classpath of the parent which allows you to put common code in the parent directory.

Next steps: #

See our intro to Jakarta and Guice if you’re not familiar with those tools, then check out Structuring an Element to get started!

What are your Feelings
Still stuck? How can we help?

How can we help?

Updated on August 26, 2025
RESTful APIs
Table of Contents
  • Deploy custom code to your instance of Namazu Elements.
  • Here's where you learn to develop your first Element.
    • Defining an Element
    • Packaging an Element
  • Next steps:
  • Documentation
  • Terms of Service
  • Privacy Policy
  • Contact us
  • Linkedin
  • Join our Discord

Namazu Studios LLC is powered by Namazu Elements, an Elemental Computing Inc. product.

Elements
  • Download
  • About Elements
  • Open source
  • Documentation
  • Support
About Namazu
  • Case Studies
  • About Us
  • News
Get in Touch
  • info@namazustudios.com
  • Book a call
  • (619) 862-2890
  • Linkedin
  • Discord

©2008-2025 Namazu Studios. All Rights Reserved.