The Devvit CLI enables you to create, upload, and manage your apps. It's the bridge between your codebase and Reddit.
:::note
We collect usage metrics when you use the Devvit CLI. For more information, see Reddit’s Developer Terms and the Reddit Privacy Policy. You can opt out at any time by using the devvit metrics off command.
:::
Bundles all SVG files in the /assets folder into a new file (src/icons.ts by default). Enabling you to import local SVG assets in your app code.
devvit create icons [output-file]-
output-filePath to the output file. Defaults to
src/icons.ts.
devvit create icons
$ devvit create icons "src/my-icons.ts"import { Devvit } from "@devvit/public-api";
import Icons from "./my-icons.ts";
// addCustomPostType() is deprecated and will be unsupported. It will not work after June 30.
Devvit.addCustomPostType({
name: "my-custom-post",
render: (_context) => {
return (
<blocks>
<image
url={Icons["my-image.svg"]}
imageHeight="32px"
imageWidth="32px"
/>
</blocks>
);
},
});
export default Devvit;Display help for devvit
devvit helpInstall an app from the Apps directory to a subreddit that you moderate. You can specify a version to install or default to @latest (the latest version).
devvit install <subreddit> [app-name]@[version]-
subredditName of the installation subreddit. The "r/" prefix is optional.
-
app-nameName of the app to install (defaults to current project).
-
versionSpecify the desired version (defaults to latest).
devvit install r/mySubreddit
$ devvit install mySubreddit my-app
$ devvit install r/mySubreddit my-app@1.2.3
$ devvit install r/mySubreddit @1.2.3To see a list of apps you've published
devvit list appsTo see a list of all apps currently installed on a specified subreddit.
If no subreddit is specified, you'll get a list of all apps installed by you.
devvit list installs [subreddit]-
subredditName of the subreddit to look up installations for. The "r/" prefix is optional.
devvit list installs
$ devvit list installs mySubreddit
$ devvit list installs r/mySubredditLogin to Devvit with your Reddit account in the browser.
devvit login [--copy-paste]-
--copy-pasteIf present, user will copy-paste code from the browser instead of the localhost.
Logs the current user out of Devvit.
devvit logoutStream logs for an installation within a specified subreddit. You can see 5,000 logs or up to 7 days of log events.
devvit logs <subreddit> [app-name] [-d <value>] [-j] [-s <value>] [--verbose]-
subredditThe subreddit name. The "r/" prefix is optional.
-
app-nameThe app name (defaults to working directory app).
-
-d <value>, --dateformat <value>Specify the format for rendering dates. Defaults to
MMM d HH:mm:ss(Jan 15 18:30:03). See more about format options here. -
-j, --jsonOutput JSON for each log line
-
-s <value>, --since <value>Specify how far back you want the log streaming to start. Defaults to a
0m(now) if omitted.Supported format:
ssecondsmminuteshhoursddayswweeks
For example
15s,2w1d, or30m. -
--verboseDisplays the log levels and timestamps when the logs were created.
devvit logs r/mySubreddit
$ devvit logs mySubreddit my-app
$ devvit logs mySubreddit my-app --since 15s
$ devvit logs mySubreddit my-app --verboseCreate a new app.
devvit new [directory-name] [--here]-
directory-nameDirectory name for your new app project. This creates a new directory for your app code. If no name is entered, you will be prompted to choose one.
-
--hereGenerate the project here and not in a subdirectory.
devvit new
$ devvit new tic-tac-toe
$ devvit new --hereInstalls your app to your test subreddit and starts a playtest session. A new version of your app is installed whenever you save changes to your app code, and logs are continuously streamed. Press ctrl+c to end the playtest session. Once ended, the latest installed version will remain unless you revert to a previous version using devvit install. For more information, see the playtest page.
devvit playtest- subreddit Name of a test subreddit with less than 200 subscribers that you moderate. The "r/" prefix is optional.
If no subreddit is specified, the command will use the first available option from:
- DEVVIT_SUBREDDIT environment variable
- dev.subreddit field in devvit.json
- The playtest subreddit stored for your app
If none exist, a new playtest subreddit will be automatically created.
List settings for your app. These settings exist at the global app-scope and are available to all instances of your app.
devvit settings listCreate and update settings for your app. These settings will be added at the global app-scope.
devvit settings set <my-setting>devvit settings set my-feature-flagUninstall an app from a specified subreddit.
devvit uninstall <subreddit> [app-name]-
subredditName of the subreddit. The "r/" prefix is optional. Requires moderator permissions in the subreddit.
-
app-nameName of the app (defaults to the working directory app).
devvit uninstall r/mySubreddit
$ devvit uninstall mySubreddit
$ devvit uninstall mySubreddit my-appUpdate @devvit project dependencies to the currently installed CLI's version
devvit update appUpload an app to the App directory. By default the app is private and visible only to you.
devvit upload [--bump major|minor|patch|prerelease] [--copyPaste]-
--bump <option>Type of version bump (major|minor|patch|prerelease)
-
--copyPasteCopy-paste the auth code instead of opening a browser
Get the version of the locally installed Devvit CLI.
devvit versionShows you the latest version of your app and some data about uploads. Includes an optional --json flag to get information in JSON format.
devvit view [APPSLUG[@VERSION]] [--json] [version]Display the currently logged in Reddit user.
devvit whoami