Overview
Devark supports both JavaScript and TypeScript for all modules. When you add a module to your project, Devark prompts you to choose your preferred language and generates the appropriate files with correct dependencies.When to Choose JavaScript
Best for rapid prototyping
Best for rapid prototyping
JavaScript is ideal when you want to move quickly without type annotations. Perfect for:
- Small projects or MVPs
- Simple APIs without complex data structures
- Teams without TypeScript experience
- Projects where build speed is critical
Less configuration overhead
Less configuration overhead
JavaScript projects require:
- No
tsconfig.jsonconfiguration - No TypeScript compiler setup
- Fewer development dependencies
- No type definition packages (
@types/*)
When to Choose TypeScript
Type safety and better IDE support
Type safety and better IDE support
TypeScript provides compile-time type checking and enhanced IntelliSense:
- Catch errors before runtime
- Better autocompletion in editors
- Refactoring with confidence
- Self-documenting code through types
Better for large-scale applications
Better for large-scale applications
TypeScript excels in:
- Projects with multiple developers
- Complex business logic
- Long-term maintenance
- Integration with typed libraries
How Language Selection Works
When you install any Devark module, you’ll see this prompt:-
Detects or prompts for entry file
- JavaScript:
app.js(root directory) - TypeScript:
src/app.ts(insidesrc/folder)
- JavaScript:
-
Installs language-specific dependencies
- JavaScript: Only runtime dependencies
- TypeScript: Adds
typescript,ts-node, and@types/*packages
-
Generates files with correct extensions
- JavaScript:
.jsfiles in root directory - TypeScript:
.tsfiles insrc/directory
- JavaScript:
Devark auto-detects TypeScript entry files by searching for
.ts files in the src/ directory if your specified entry file isn’t found.File Structure Differences
- JavaScript
- TypeScript
Code Generation Examples
Devark generates language-appropriate code for each module. Here’s how the same Google OAuth strategy looks in both languages:Dependency Differences
Devark automatically installs the correct dependencies based on your language choice:- JavaScript
- TypeScript
Runtime dependencies only:
Migration Guide
Starting with JavaScript
If you’re unsure which to choose, start with JavaScript:- Install modules with JavaScript option
- Build your features quickly
- Migrate to TypeScript later if needed
Migrating to TypeScript
When you’re ready to adopt TypeScript:You can run JavaScript and TypeScript side-by-side during migration. TypeScript can import JavaScript files without issues.
Best Practices
JavaScript Projects
- Keep files organized in folders (routes, controllers, config)
- Use JSDoc comments for basic type hints
- Leverage ES6+ features
- Consider migrating to TS as project grows
TypeScript Projects
- Enable strict mode in tsconfig.json
- Define interfaces for API responses
- Use enums for constants
- Leverage utility types (Partial, Pick, Omit)
Source Code Reference
Devark’s language selection logic is implemented in:src/modules/*/install.js- Module installation with language prompts (lines 36-47)src/utils/packageManager.js- Dependency installation logic- Template files in
templates/javascript/andtemplates/typescript/directories

